Skip to content

Instantly share code, notes, and snippets.

@thulioph
Created December 20, 2013 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thulioph/8056620 to your computer and use it in GitHub Desktop.
Save thulioph/8056620 to your computer and use it in GitHub Desktop.
link âncora com scroll animado
// 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