Created
June 11, 2013 02:32
-
-
Save rodcisal/5754132 to your computer and use it in GitHub Desktop.
Smooth Scrolling
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
$('.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(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to to this cause meteor template events didn't work when I was trying to implement smooth scrolling.