Skip to content

Instantly share code, notes, and snippets.

@jlittlejohn
Created March 22, 2014 21:24
Show Gist options
  • Save jlittlejohn/9714595 to your computer and use it in GitHub Desktop.
Save jlittlejohn/9714595 to your computer and use it in GitHub Desktop.
JS: Animate ScrollTo Inpage Navigation
// Animate ScrollTo InPage Navigation
$(function(){
$("a.inpage").bind("click", function (event) {
event.preventDefault();
var target = $(this).attr("href");
var headerHeight = $('body > header').height();
$("html, body").stop().animate({
scrollTop: $(target).offset().top - headerHeight
}, 1200);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment