pixelcog / parallax.js

Simple parallax scrolling effect inspired by Spotify.com implemented as a jQuery plugin
MIT License
3.53k stars 840 forks source link

Pass additional HTML attributes to parallax container #271

Closed ehrig closed 5 years ago

ehrig commented 5 years ago

Is it possible to pass additional HTML attributes to the parallax container? I does not seem possible with the provided data attribute options.

In my specific case I need to pass CSS classes to each parallax HTML container.

Something like: data-classes="css-filter"

wstoettinger commented 5 years ago

please check for the JavaScript initialization method, thrn you have full flexibility!

ehrig commented 5 years ago

Alright, I ended up using innerHTML (https://github.com/pixelcog/parallax.js#using-inner-html-for-complex-content) paired with $('.parallax-window').parallax() to init and pass style attributes to the parallax container with some vanilla JS.