Skip to content

Instantly share code, notes, and snippets.

@bezenson
Created April 27, 2014 12:46
Show Gist options
  • Save bezenson/11344721 to your computer and use it in GitHub Desktop.
Save bezenson/11344721 to your computer and use it in GitHub Desktop.
Smooth mouse scrolling
// 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