Skip to content

Instantly share code, notes, and snippets.

@brunobuddy
Created August 21, 2015 09:39
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 brunobuddy/4826a7fbb36b7835fd05 to your computer and use it in GitHub Desktop.
Save brunobuddy/4826a7fbb36b7835fd05 to your computer and use it in GitHub Desktop.
Smooth Scroll
/*-----------------------------------*\
#Smooth Scroll
\*-----------------------------------*/
$('.smooth-scroll').click( function() {
var page = $(this).attr('href');
var headerHeight = 80;
var speed = 400; // Durée de l'animation (en ms)
$('html, body').animate( { scrollTop: $(page).offset().top - headerHeight }, speed ); // On récupére l'espace perdu avec le header.
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment