-
Notifications
You must be signed in to change notification settings - Fork 423
Fix value of 'speed' when set default is 'auto' #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,11 +169,15 @@ $.smoothScroll = function(options, px) { | |
| // automatically calculate the speed of the scroll based on distance / coefficient | ||
| if (speed === 'auto') { | ||
|
|
||
| // if aniProps[scrollDir] == 0 then we'll use scrollTop() value instead | ||
| speed = aniProps[scrollDir] || $scroller.scrollTop(); | ||
| // $scroller.scrollTop() is brefore scroll, aniProps[scrollDir] is after scroll | ||
| //'delta' is value changing. When 'delta' bigger, then 'speed' will be larger same and vice versa. | ||
| var delta = aniProps[scrollDir] - $scroller.scrollTop(); | ||
| if(delta < 0) { | ||
| delta *= -1; | ||
| } | ||
|
|
||
| // divide the speed by the coefficient | ||
| speed = speed / opts.autoCoefficent; | ||
| speed = delta / opts.autoCoefficent; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For sake of consistancy of format:
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @travco, it's actually good as is. |
||
| } | ||
|
|
||
| aniOpts = { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion for comment text:
//'delta' is a storage variable for the difference in offsets between // $scroller.scrollTop() , and aniProps[scrollDir] .