Skip to content

Instantly share code, notes, and snippets.

@eliasfaical
Forked from thulioph/scroll-ancora.js
Created February 12, 2014 18:34
Show Gist options
  • Save eliasfaical/8961726 to your computer and use it in GitHub Desktop.
Save eliasfaical/8961726 to your computer and use it in GitHub Desktop.
// 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