Created
December 20, 2013 15:47
-
-
Save thulioph/8056620 to your computer and use it in GitHub Desktop.
link âncora com scroll animado
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
// class dos links que vão receber o click | |
$(".link-menu").on("click", function(event){ | |
// a animação vai ocorrer no html, body | |
$('html, body').animate({ | |
// pega o atributo href do this (link que recebeu o click) | |
// e faz a animação com velocidade 1000 para o destino do href; | |
scrollTop: $($(this).attr("href")).offset().top | |
}, 1000); | |
// Faz com que o destino do link não vá para a url | |
event.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment