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',
2828 beforeScroll : function ( ) { } , // fn(opts) function to be called before scrolling occurs. "this" is the element(s) being scrolled
2929 afterScroll : function ( ) { } , // fn(opts) function to be called after scrolling occurs. "this" is the triggering element
3030 easing : 'swing' ,
31- speed : 400
31+ speed : 400 ,
32+ auto_coeff : 2 // coefficient for "auto" speed
3233 } ,
3334
3435 getScrollable = function ( opts ) {
@@ -168,6 +169,18 @@ $.smoothScroll = function(options, px) {
168169 opts . afterScroll . call ( opts . link , opts ) ;
169170
170171 } 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+
171184 $scroller . animate ( aniprops ,
172185 {
173186 duration : opts . speed ,
You can’t perform that action at this time.
0 commit comments