File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ var version = '1.4.4',
28
28
beforeScroll : function ( ) { } , // fn(opts) function to be called before scrolling occurs. "this" is the element(s) being scrolled
29
29
afterScroll : function ( ) { } , // fn(opts) function to be called after scrolling occurs. "this" is the triggering element
30
30
easing : 'swing' ,
31
- speed : 400
31
+ speed : 400 ,
32
+ auto_coeff : 2 // coefficient for "auto" speed
32
33
} ,
33
34
34
35
getScrollable = function ( opts ) {
@@ -168,6 +169,18 @@ $.smoothScroll = function(options, px) {
168
169
opts . afterScroll . call ( opts . link , opts ) ;
169
170
170
171
} else {
172
+ var speed ;
173
+ if ( opts . speed === 'auto' ) {
174
+ if ( aniprops [ scrollDir ] === 0 ) {
175
+ speed = $ ( 'html' ) . scrollTop ( ) ;
176
+ } else {
177
+ speed = aniprops [ scrollDir ] ;
178
+ }
179
+ speed = speed / opts . auto_coeff ;
180
+ } else {
181
+ speed = opts . speed ;
182
+ }
183
+
171
184
$scroller . animate ( aniprops ,
172
185
{
173
186
duration : opts . speed ,
You can’t perform that action at this time.
0 commit comments