Skip to content

Instantly share code, notes, and snippets.

@JLevstein
Created October 26, 2014 17:46
Show Gist options
  • Save JLevstein/23ae16f4605273b1910f to your computer and use it in GitHub Desktop.
Save JLevstein/23ae16f4605273b1910f to your computer and use it in GitHub Desktop.
Basic scrollTo function
$('.primary-nav').on('click', 'a', function(e) {
e.preventDefault();
var target = $(this).attr('href');
var destination = $(target).offset().top;
$('html:not(:animated),body:not(:animated)').stop().animate({
scrollTop: destination - 60
}, 600);
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment