dixonandmoe / rellax

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

Elements targeted for parallax are re-positioned on the page #204

Open seangpachareonsub opened 4 years ago

seangpachareonsub commented 4 years ago

Hi there,

I may be doing something wrong but when adding the 'rellax' class to initialize the effect, it re-positions the elements according to how fast/slow the speed is.

speed > 0 elements are repositioned further up from original position and vice versa for < 0

Any help would be appreciated! Thank youu

ourystefan commented 4 years ago

I am having the same problem.

bloomdigital commented 4 years ago

Same issue here. Any further forward?

Kumail786 commented 3 years ago

same with me, anyone found the solution?

robertimes commented 3 years ago

+1

archatas commented 3 years ago

I can confirm, that the elements are repositioned. That's a problem with anchor links, because links like

<a href="#faq">FAQ</a>

jump to a wrong position on a page.

Otherwise this library is very nice!

sergiovieira commented 3 years ago

I'm having the exact same problem but happens only on the second element that I add the rellax class to.

If I add the speed=0 the element is ok, but of course, doesn't have any parallax effect.

The elements are images that are in the background and positioned relative to full width sections:

dr-waterstorm commented 2 years ago

Sadly I have the same issue and could not fix it yet. Maybe it's related to the fact that my rellax elements are children of a "position: relative" parent and always adjust to that parent instead of the page itself. All elements get moved on init as the OP said and in addition, if I change the browser window size, all elements start moving as well.

The demo website somehow does not show that behaviour.

hrvstr commented 1 year ago

The demo website somehow does not show that behavior.

Good hint, I checked the implementation on the demo website and got anchor links working by wrapping the .rellax element in a section with position:static.

<section style="postition: static">
  <h2 class="rellax" data-rellax-speed="-3">San Francisco<br />California</h2>
</section>