dixonandmoe / rellax

Lightweight, vanilla javascript parallax library
https://dixonandmoe.com/rellax/
MIT License
7.07k stars 876 forks source link

relativeToWrapper option is relative to relatively positioned parent, not top of page #177

Closed daltonrooney closed 4 years ago

daltonrooney commented 4 years ago

I noticed when I use the relativeToWrapper option (which seems to be broken in 1.10) that the position was way off, sometimes thousands of pixels. I realized that's because the feature is using .offsetTop, which only calculates the offset relative to the next relative parent.

https://github.com/dixonandmoe/rellax/blob/5b7f64f4c3d55dc0cc6fd58b7b17f0d5b88aacd4/rellax.js#L186

daltonrooney commented 4 years ago

Going to close this because the proposed solution only works with 1.9.1