Reputation: 3536
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
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