-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new boolean option, relativeToWrapper. #125
Conversation
This addition originates from the need to let movement be relative to a wrapper, rather than scroll position of a wrapper or the scroll position of the window. We'll use the wrappers vertical offset, and subtract it from the scrollposition, to enable an effect, that feels like the element is relative to its wrapper instead. Simply a boolean, telling us whether or not it should be relative to the container selected in the wrapper option.
I just reviewed this as a potential fix, and for my use case, this seems to do the trick. I was half expecting this to support multiple |
How can i use this for horizontal scrolling? |
This feature is currently only supported for vertical scrolling. |
@MadsMadsDk can you make it work for horizontal scrolling? |
@MadsMadsDk Should I merge or you interested in adding it for horizontal? |
@moeamaya You can merge this - I'll do another PR for horizontal if I get the time to look into it. Shouldn't be too hard though. |
Does relativeToWrapper still work with the current version of Rellax? When I add relativeToWrapper:true, the rellax elements stop moving. The transform CSS does not change on scroll. |
Same thing using wrapper: this.parentElement 😞 |
This is a great addition, but it seems to be broken in the current version (if I'm not mistaken) As far as my understanding goes, setting a wrapper will enable Rellax to use the scroll position inside the wrapper for the movement. If there is no scrolling inside the element which was set as a wrapper, Rellax won't move anything. This option Using "relativeToWrapper" at the moment will result in the object being further down the page (so I can confirm that the initial calculation |
This addition originates from the need to let movement be relative to a wrapper, rather than scroll position of a wrapper or the scroll position of the window.
We'll use the wrappers vertical offset, and subtract it from the scrollposition, to enable an effect, that feels like the element is relative to its wrapper instead.
Simply a boolean, telling us whether or not it should be relative to the container selected in the wrapper option.