electerious / basicScroll

Standalone parallax scrolling for mobile and desktop with CSS variables.
https://basicscroll.electerious.com
MIT License
3.63k stars 148 forks source link

Possible to create array of instances? #4

Closed LukeCarlThompson closed 6 years ago

LukeCarlThompson commented 6 years ago

Great thinking behind the library.

I've been playing around with it today and ran into a problem trying to give the same parallax effect to multiple elements.

If I had five divs with class ".box" would it be possible to loop through an array of all the box elements and apply basicScroll to all of them.

I'm fairly new to Javascript so I apologise in advance if this is something trivial and not at all related to your library. The techniques I've used with animation libraries doesn't work for this so I'm a bit confused.

edit: Just found the codepen example that has exactly that in it. Thanks for your time, and I'll see myself out.....