Skip to content
Advertisement

JavaScript Smooth Scroll not working

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;
});

Advertisement

Answer

remove overflow-x: hidden; and it will work

See here http://jsfiddle.net/acidrat/Wt2rp/1/

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement