Skip to content

Instantly share code, notes, and snippets.

@rawaludin
Created November 19, 2012 13:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawaludin/4110578 to your computer and use it in GitHub Desktop.
Save rawaludin/4110578 to your computer and use it in GitHub Desktop.
jquery : smooth scroll
$(document).ready(function() {
// animation of navigation
$(function() {
$('.nav-collapse .nav li a').bind('click',function(event){
var anchor = $(this);
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top - $('.navbar-inner').height() - ($('.navbar-inner').height()/4.8)
}, 1500/*,'easeInOutExpo'*/);
event.preventDefault();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment