109
rated 0 times
[
111]
[
2]
/ answers: 1 / hits: 16410
/ 10 Years ago, fri, may 2, 2014, 12:00:00
I'm attempting to create a smooth scrolling page, but it seems to not work. If I remove the smooth scrolling aspect of my site, the anchor automatically jumps to the div element like usual.
I have attached a JSFiddle: http://jsfiddle.net/J7sxD/5/
var $root = $('html, body');
$('a').click(function() {
$root.animate({
scrollTop: $( $(this).attr('href') ).offset().top
}, 500);
return false;
});
More From » jquery