Mattrudd Posted February 19, 2022 Posted February 19, 2022 Hi folks, trying to integrate a cursor change on hover (a play button over a video thumbnail). I can't seem to work out why, when I add the hover section to a page with ScrollTrigger, the button appears above (offset - vertically up the page from) the container and not over it as intended? Tried lots of variations of thumbnail container CSS positioning so wondering whether I'm missing something in my scroller proxy settings? See the Pen zYPpamW by matt-rudd (@matt-rudd) on CodePen.
Solution GreenSock Posted February 19, 2022 Solution Posted February 19, 2022 If I understand your question correctly, that's just how CSS works. If you put a position: fixed element inside a container that has a transform applied to it (which LocomotiveScroll does), it suddenly makes the fixed positioning relative to the container instead of the viewport! Annoying, I know. But again, it's completely unrelated to GSAP/ScrollTrigger. If you want it to act relative to the viewport, you'll need to remove it from that transformed container or counter-transform it in the opposite direction as its container is moving to compensate. Good luck! 1
Mattrudd Posted February 19, 2022 Author Posted February 19, 2022 @GreenSock Thanks Jack - it was literally as simple as taking the hover element out of the main container. Genuinely considered it to be something I was getting wrong with my GSAP settings! I am trying to stick to the script here (pun intended). 2
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now