Skip to content

Instantly share code, notes, and snippets.

@rodcisal
Created June 11, 2013 02:32
Show Gist options
  • Save rodcisal/5754132 to your computer and use it in GitHub Desktop.
Save rodcisal/5754132 to your computer and use it in GitHub Desktop.
Smooth Scrolling
$('.menu').bind('click',function(event){
var $anchor = $(this);
$('html, body')
.stop() //stop the animation
.animate({
scrollTop: //scrollTop setea la barra de scroll
$($anchor.attr('href'))
.offset()
.top
}, 1000);
/*
if you don't want to use the easing effects:
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1000);
*/
event.preventDefault();
});
});
@rodcisal
Copy link
Author

Had to to this cause meteor template events didn't work when I was trying to implement smooth scrolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment