Skip to content

Instantly share code, notes, and snippets.

@KarbonDallas
Created June 13, 2012 00:55
Show Gist options
  • Save KarbonDallas/2921105 to your computer and use it in GitHub Desktop.
Save KarbonDallas/2921105 to your computer and use it in GitHub Desktop.
animated scroll...
var easyScroll = function(selector, cb) {
var offset = $(selector).offset().top;
$('html, body').stop(true).animate({ scrollTop : ( (offset - 75 ) < 0 ? 0 : (offset - 75) ) }, {
duration : 300
}, function(){
if((cb) && (typeof cb == "function")) {
cb();
}
});
}
@KarbonDallas
Copy link
Author

75 is good for my styles, adjust it accordingly for fixed navbars, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment