Created
April 27, 2014 12:46
-
-
Save bezenson/11344721 to your computer and use it in GitHub Desktop.
Smooth mouse scrolling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script don't work very good. It will be very good, if you can to improve it :) | |
var page = $('body'), | |
scrollRange = 60, | |
scrollSpeed = 200; | |
$(window).mousewheel(function(event, delta, deltaX, deltaY) { | |
if (delta < 0) { | |
page.stop(true,true).animate({scrollTop: page.scrollTop()+scrollRange}, scrollSpeed); | |
} else if (delta > 0) { | |
page.stop(true,true).animate({scrollTop: page.scrollTop()-scrollRange}, scrollSpeed); | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment