Make Element Scroll Slower (parallax)
I have an element on my page absolutely positioned. Im trying to write a snippet of jQuery to make that element scroll at a slower rate than the rest of the elements on the page.
Solution 1:
I can point you in the right direction. You need your $('.twit-bird').css()
to get called every time the window is scrolled. Also you forgot .scrollTop()
, and don't quote window
(or, even better just use this
) ...
$(window).scroll(function () {
$('.twit-bird').css({
'top' : -($(this).scrollTop()/3)+"px"
});
});
Solution 2:
Here is a very very good tutorial for parallax scrolling. It made me understanding how it really works.
Post a Comment for "Make Element Scroll Slower (parallax)"