Snapper
Snapper

Reputation: 686

How to move an element on scroll

I want to move some elements (divs with images) vertically at different speed. I already achieve this partially with the animate jquery function with anchors. However I couldn't figure it out how to do it with the scroll event. I want the same movement (vertically at different speed) also through the scrolling. The scrolling must have the same effect on the "browser-scroll" and on the "mouse-scroll" (no sure about these names).

function scroll() {
    $("#logo").animate({ "top": "+=180px" }, 1000);
$("#logo2").animate({ 'top': "+=450px"}, 1000);
}

this is the function that I got.

I made same research and I found some cases but none of them helped me really.

Any help would be much appreciated.

Upvotes: 0

Views: 6017

Answers (1)

Marco Johannesen
Marco Johannesen

Reputation: 13134

See: http://jsfiddle.net/5HHxK/1/

What is it you want? If you want different speeds, with same "position", just slow the speed :)

Upvotes: 2

Related Questions