-
Notifications
You must be signed in to change notification settings - Fork 868
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
translate3d creating a blank space #44
Comments
@chaddattilio-lyons Yea this is definitely a problem. I don't have an immediate solution outside of using the |
Additionally I was having an issue with horizontally centering an absolutely positioned box, because the translate3d inline is overriding my CSS for translateX, if these properties were separated out rather than all in one, could help with these types of bugs. |
Checked the demo, translate Y values are negative but when I tried locally translate Y values are positive. This resulted in image staying at the same position as the container div is moved. So I modified the code a bit to get negative values and that fixed the issue for me. |
@thewebsitedev that negative Y value depends really on the Hey @moeamaya I gave a thought to the problem of the blank spaces being created, specifically when using the Take a look at that picture (sorry for bad drawing, not really good at it): So,
If I understand correctly, the That is, in order to make sure we never create a blank space, we have to make sure that What I'm looking for, is a simple way of computing those I think that should somehow push us toward a solution for that issue. Does any of that make any sense? |
I'm not sure if this is the right solution, but this seems to work for me: In the const computedStyle = document.defaultView.getComputedStyle(el);
const transform = computedStyle.transform; This will result in a property like: Instead of checking for inline styles and placing those in the
This property is then set on the element within the // Move that element
// (Set the new translation and append initial inline transforms.)
const translate = `translate3d(${
self.options.horizontal ? positionX : '0'
}px,${self.options.vertical ? positionY : '0'}px,${zindex}px) ${
blocks[i].transform
}`; |
Hi @vernondegoede is it still working? Tried it out and it doesn't seem to run. Where exactly in the code is it supposed be placed at? |
Might be using this wrong, but the last "rellax" div on the page creates a big blank space on the page as it translates upward. Any ideas?
Thanks for a good simple library!
The text was updated successfully, but these errors were encountered: