Skip to content

Instantly share code, notes, and snippets.

@rabellamy
Last active December 13, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabellamy/4953720 to your computer and use it in GitHub Desktop.
Save rabellamy/4953720 to your computer and use it in GitHub Desktop.
Nice scroll
(function($){
$(document).ready(function($){
// Scroll from header to menu in footer for small-screen devices
$("#bye").click(function(event) {
event.preventDefault();
var full_url = this.href;
var parts = full_url.split('#');
var trgt = parts[1];
var target_offset = $('#'+trgt).offset();
var target_top = target_offset.top;
$('html, body').animate({scrollTop:target_top}, 1000);
});
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment