Jump to content
Search Community

Parallax image with dataset

Umberto test
Moderator Tag

Recommended Posts

I'm having a hard time understanding exactly what your goal is (what the effect is supposed to look like), but if you are simply trying to make the image look like it's position: fixed inside its container, perhaps you should look at the CSS property background-attachment: 

https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment

 

Otherwise, if you still need help please make sure you are very clear about the effect you want (maybe provide a sample URL). We don't really do build-to-order things here in the forums, but we're happy to answer any GSAP-specific questions you may have. 

Link to comment
Share on other sites

I apologize for my bad English.
Exactly, the image doesn't flow 100% in its container with class overflow: hidden. This happens if I increase the data-speed (example a data-speed:"1", data-speed:"2" or data-speed:"-1", data-speed:"-2"). What I wanted to understand if it was a Gsap or Css setting error.

I have attached a photo to better understand the problem.

Thank you

 

 

Schermata-2023-03-06-alle-17.29.01.jpg

Link to comment
Share on other sites

Oh, yeah, that's more of a math thing with figuring out how bit the image is, how much of a gap there is inside the container, the start/end positions in the viewport, the distance it'll travel, etc. I spent a ton of time figuring that stuff out to build ScrollSmoother's data-speed="auto" feature. It wasn't trivial, that's for sure. :) 

 

You can't just set arbitrary speeds and expect it to work because if you only have 20px of overlap, for example, but you set a data-speed of 5...it'll shoot way past that 20px. See what I mean? 

 

Good luck!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...