Created
August 21, 2015 09:39
-
-
Save brunobuddy/4826a7fbb36b7835fd05 to your computer and use it in GitHub Desktop.
Smooth Scroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-----------------------------------*\ | |
#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