Jay Wit Jay Wit - 5 months ago 5x
Javascript Question

Smooth JavaScript/jQuery scroll to element

I'm trying to make a horizontal scroll website, but I don't know how to smoothly scroll from one element to the other.
I tried the following code:

$("a[href='#top']").click(function() {
$("body").animate({ scrollTop: 0 }, "slow");
return false;

But it only scrolls to the top, I also tried the jQuery-plugin ScrollTo, but I just can't get it to work, I also tried the jQuery plugin:

$.scrollTo( '.last', 800, {easing:'elasout'});

But also without succes.

Does anyone know a good, easy to understand, sample I can use? Thanks in advance!



        $.scrollTo( $('.last'), 800);