Prakhar
Prakhar

Reputation: 3536

How do I get this scroll effect?

I just started to learn jQuery and I came across this site- TEDx Portland and I really like the scroll effect and the fact that the entire site is just one page.

Considering I'm a beginner are there any resources one can point at so that I accomplish a similar effect(the smooth and eased animation)

Thanks

Upvotes: 1

Views: 178

Answers (2)

themerlinproject
themerlinproject

Reputation: 3582

No plugin necessary with jQuery:

$('.scrollPage').click(function() {
   var elementClicked = $(this).attr("href");
   var destination = $(elementClicked).offset().top;
   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 500 );
   return false;
});

The code gets the href from the anchor and uses it as the target element. If you want to adjust the scroll speed just change the 500. Demo. Original.

And here's another tutorial.

Upvotes: 2

Rafael
Rafael

Reputation: 18522

You can use a jQuery plugin, for example scrollTo

Upvotes: 3

Related Questions