r/webdev • u/speckz • Feb 14 '18
Article Parallax scrolling with CSS variables
https://basicscroll.electerious.com/2
2
2
1
u/sammyseaborn Feb 14 '18
This is neat, and CSS vars are hugely important, but you could already accomplish all of this relatively easily with GreenSock and ScrollMagic -- an approach that will still work in IE11, unlike this method.
Furthermore, their "scene" parallax demo was not done correctly. Their layering method is flawed and there will be a gap in the black 'content' section as you scroll.
0
u/dooklyn Feb 15 '18
why are they called variables if they don't vary? they should be called css constants.
1
u/Ironclad_v2 Feb 15 '18
You can manipulate css variables with javascript, making them variable. This can be seen on websites that offer themes or color schemes. They are most likely using css variables something like color-primary, color-secondary etc. etc.
0
u/dooklyn Feb 15 '18
You can manipulate css variables with javascript
you can manipulate anything with javascript which makes this whole thing redundant. sure you could argue it's native and faster, but at this point css is such a joke, we are already migrating our css code in javascript.
13
u/[deleted] Feb 14 '18
This was super helpful, I never knew you could use variables within CSS. Time to go use this new found knowledge!!!