Parallax scrolling object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Parallax scrolling object

Guys, I`m stuck with parallax scrolling. Can someone help me? I want to create a 2 column website: 5% ( left - content area - 60% ) (right - widget - 30%) 5% i want the widget column to scroll twice slower. Can someone point me in the right direction ?

27th Jul 2017, 3:47 PM
Ненад Вичентиќ
Ненад Вичентиќ - avatar
3 Answers
+ 2
One solution would be to create a fixed or static element then to translateY using the transform properties of CSS3. document.querySelector('.mydiv').style.transform = 'translateY(-'+pageYoffset*0.5+')' Or you can use parallax plug-in / libs...
27th Jul 2017, 3:51 PM
Drax
Drax - avatar
+ 1
Set the widget column to fixed position. Use Javascript to detect scroll event, set its top value accordingly. Check out the code here.. https://code.sololearn.com/WCL7408ak0Cg/?ref=app
28th Jul 2017, 4:03 AM
Calviղ
Calviղ - avatar
+ 1
Thanks Calvin, the exact thing i need.
28th Jul 2017, 10:10 AM
Ненад Вичентиќ
Ненад Вичентиќ - avatar