javascript - How to move left to right a div on scroll? -


I would like to animate in JS on a simple device as you can find here.

As you can see, the animation responds to scroll up / down and move horizontally. This is usually what I want to do, how can I easily set up this feature in JS? Thanks

This is called parallax .

You can find it yourself using a combination of CSS attribution changes and scrolling events, or just use a plugin such as scroller

for this particular example For, you can change the inline styles of that device on the scroll (in the developer) tool:

  & lt; Div class = "album-holder" style = "background-position: 1174px 50%;" & Gt; ...  

You can do it on scroll events:

  $ (window) .scroll (function () {$ ("album- Holder "). CSS (" background-condition ", [VALUE]);});  

Where [VALUE] will be calculated by increasing / decreasing the background-position by the value each time.

EDIT: I have failed to mention it, my answer is based on the jQuery basis on the page on this page, I suggest that it is for such actions.


Comments