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
+31-11Lines changed: 31 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -26,14 +26,19 @@ The following options, shown with their default values, are available for both `
26
26
speed: 400
27
27
}
28
28
29
-
The options map for `$.fn.smoothScroll` can take two additional properties: `exclude` and `excludeWithin`. The value for both of these is an array of selectors, DOM elements or jQuery objects. Default value for both is an empty array.
29
+
The options map for `$.fn.smoothScroll` can take two additional properties:
30
+
`exclude` and `excludeWithin`. The value for both of these is an array of
31
+
selectors, DOM elements or jQuery objects. Default value for both is an
32
+
empty array.
30
33
31
34
32
35
### $.smoothScroll
33
36
34
37
* Utility method works without a selector: `$.smoothScroll()`
35
-
* Can be used to scroll any element (not just `document.documentElement` / `document.body`)
36
-
* Doesn't automatically fire, so you need to bind it to some other user interaction. For example:
38
+
* Can be used to scroll any element (not just `document.documentElement` /
39
+
`document.body`)
40
+
* Doesn't automatically fire, so you need to bind it to some other user
41
+
interaction. For example:
37
42
38
43
$('button.scrollsomething').click(function() {
39
44
$.smoothScroll({
@@ -44,11 +49,14 @@ The options map for `$.fn.smoothScroll` can take two additional properties: `exc
44
49
});
45
50
46
51
* The `$.smoothScroll` method can take one or two arguments.
47
-
* If the first argument is a number, the document is scrolled to that position. If it's an options map, those options determine how the document (or other element) will be scrolled.
48
-
* If a number is provided as the second argument, it will override whatever may have been set for the `scrollTarget` option.
52
+
* If the first argument is a number, the document is scrolled to that
53
+
position. If it's an options map, those options determine how the
54
+
document (or other element) will be scrolled.
55
+
* If a number is provided as the second argument, it will override whatever may have been set for the `scrollTarget` option.
49
56
50
57
#### Additional Option
51
-
The following option, in addition to those listed above, is available for `$.smoothScroll`:
58
+
The following option, in addition to those listed above, is available
59
+
for `$.smoothScroll`:
52
60
53
61
{
54
62
// jQuery set of elements you wish to scroll.
@@ -58,15 +66,27 @@ The following option, in addition to those listed above, is available for `$.smo
58
66
59
67
### $.fn.scrollable
60
68
61
-
* Selects the matched element(s) that are scrollable. Acts just like a DOM traversal method such as `.find()` or `.next()`.
62
-
* The resulting jQuery set may consist of **zero, one, or multiple** elements.
69
+
* Selects the matched element(s) that are scrollable. Acts just like a
70
+
DOM traversal method such as `.find()` or `.next()`.
71
+
* The resulting jQuery set may consist of **zero, one, or multiple**
72
+
elements.
63
73
64
74
### $.fn.firstScrollable
65
75
66
-
* Selects the first matched element that is scrollable. Acts just like a DOM traversal method such as `.find()` or `.next()`.
76
+
* Selects the first matched element that is scrollable. Acts just like a
77
+
DOM traversal method such as `.find()` or `.next()`.
67
78
* The resulting jQuery set may consist of **zero or one** element.
68
-
* This method is used *internally* by the plugin to determine which element to use for "document" scrolling: `$('html, body').firstScrollable().animate({scrollTop: someNumber}, someSpeed)`
79
+
* This method is used *internally* by the plugin to determine which element
* The plugin's `$.fn.smoothScroll` and `$.smoothScroll` methods use the `$.fn.firstScrollable` DOM traversal method (also defined by this plugin) to determine which element is scrollable. If no elements are scrollable, these methods return a jQuery object containing an empty array, just like all of jQuery's other DOM traversal methods. Any further chained methods, therefore, will be called against no elements (which, in most cases, means that nothing will happen).
86
+
* The plugin's `$.fn.smoothScroll` and `$.smoothScroll` methods use the
87
+
`$.fn.firstScrollable` DOM traversal method (also defined by this plugin)
88
+
to determine which element is scrollable. If no elements are scrollable,
89
+
these methods return a jQuery object containing an empty array, just like
90
+
all of jQuery's other DOM traversal methods. Any further chained methods,
91
+
therefore, will be called against no elements (which, in most cases,
0 commit comments