Reputation: 1170
Can someone help me turn my code into one that will animate the scroll. I've been researching and trying to do it myself but I'm obviously not doing something correctly.
Here is my JS:
$(function() { //When the document loads
$(".jrm-menu-whyus > a").bind("click", function() {
$(window).scrollTop($("#menu-jrm").offset().top);
return false;
});
});
Thanks!
It works fine, just want to animate the scroll.
Upvotes: 0
Views: 58
Reputation: 18312
Use jQuery.animate():
$("html, body").animate({scrollTop: $("#menu-jrm").offset().top});
Upvotes: 1