Ben Shelock
Ben Shelock

Reputation: 20985

Facebook-like anchor scroll

Facebook has a nice scroll effect which I would like to replicate with jQuery. When you load a page it starts at the top then scrolls to the selected anchor.

I've tried doing this (page.html#anchor) and using the scrolling plugin for jQuery however it just goes straight to that anchor without using the scroll effect.

So can I delay the scroll when the page is loaded then use jQuery to do the scrolling instead?

I apologise if I have explained it badly.

Upvotes: 2

Views: 1879

Answers (1)

mjc
mjc

Reputation: 3426

http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12

basically, you're going to want to animate the scrollTop CSS property.

$(document).animate({scrollTop: AMOUNT}, 1000);

Upvotes: 5

Related Questions