You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+84-50Lines changed: 84 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,50 +5,69 @@ Responsive Bootstrap Toolkit provides an easy way of breakpoint detection in Jav
5
5
6
6
The SASS module enables quick and simple styling for elements needing different property values for each screen resolution.
7
7
8
-
Current version: 2.3.0
8
+
Current version: **2.3.0**
9
9
10
-
[See a live example on CodePen](http://codepen.io/dih/full/ivECj)
10
+
### Table of Contents
11
+
*[Live example](#live-example)
12
+
*[Migrating from an older version](#migrating-from-an-older-version)
13
+
* JavaScript features
14
+
*[Basic usage](#basic-usage)
15
+
*[Execute code on window resize](#execute-code-on-window-resize)
16
+
*[Get alias of current breakpoint](#get-alias-of-current-breakpoint)
17
+
*[Taking precautions](#taking-precautions)
18
+
*[How do I include it in my project?](#how-do-i-include-it-in-my-project)
19
+
*[Dependencies](#dependencies)
20
+
* SASS features
21
+
*[Basic usage](#sass-features)
22
+
*[How do I include it in my project?](#sass-instructions)
23
+
*[Dependencies](#sass-dependencies)
11
24
12
-
### JavaScript
13
-
#### Determine which breakpoint is active
25
+
### Live example
14
26
15
-
````javascript
16
-
if (viewport.is('xs')) {
17
-
// do stuff in the lowest resolutions only!
18
-
}
27
+
Available on [CodePen](http://codepen.io/dih/full/ivECj)
19
28
20
-
if (viewport.is('lg')) {
21
-
// do stuff on huge screens only
22
-
}
23
-
````
29
+
### Migrating from an older version
24
30
25
-
#### Execute a script whenever window is resized
26
-
##### Default interval, 300 ms
31
+
Refer to the [changelog](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/blob/master/CHANGELOG.md) for a list of improvements in each version of the library.
27
32
28
-
````javascript
29
-
$(window).bind('resize', function() {
30
-
viewport.changed(function() {
31
-
32
-
// do some other stuff!
33
+
### JavaScript features
34
+
#### Basic usage:
33
35
34
-
})
35
-
});
36
+
````javascript
37
+
// Wrap IIFE around your code
38
+
(function($, viewport){
39
+
40
+
// Do stuff in the lowest resolutions only
41
+
if( viewport.is('xs') ) {
42
+
// ...
43
+
}
44
+
45
+
// Execute code each time window size changes
46
+
$(window).bind('resize', function() {
47
+
viewport.changed(function(){
48
+
if( viewport.is('xs') ) {
49
+
// ...
50
+
}
51
+
});
52
+
});
53
+
54
+
})(jQuery, ResponsiveBootstrapToolkit);
36
55
````
37
56
38
-
##### Custom interval
57
+
#### Execute code on window resize
58
+
Allows using custom debounce interval. The default one is set at 300ms.
<!-- Your scripts using Responsive Bootstrap Toolkit -->
105
-
<scriptsrc="js/main.js"></script>
106
-
````
107
-
108
-
#### SASS
109
-
149
+
#### SASS Instructions
110
150
Copy contents of `compass/bootstrap-toolkit` directory into your project. File `style.scss` contains lines that need to be in your own style.scss for the mixin to work. You'll need SASS 3.3+.
111
151
112
152
113
-
### Dependencies
114
-
115
-
**JavaScript features:**
116
-
1. Bootstrap's responsive utility css classes included in its standard stylesheet package
0 commit comments