rag Posted July 29, 2020 Share Posted July 29, 2020 Hi guys, is it possible to fade an element in, after scrolling lets say 120% of the viewport? The element is a fixed element (back to top button). I tried using the position of the .header element (top navbar) and trigger the animation, when the .header is 500px out of the viewport. gsap.to(".js-back-to-top", { scrollTrigger: { trigger: ".header", markers: true, start: -500, onToggle: self => console.log("toggled, isActive:", self.isActive), }, autoAlpha: 1, }); thank you for your help Link to comment Share on other sites More sharing options...
ZachSaucier Posted July 29, 2020 Share Posted July 29, 2020 Hey rag. I recommend using the body as the trigger instead of some other element (whose position might change): See the Pen NWxZPOp?editors=0010 by GreenSock (@GreenSock) on CodePen 3 Link to comment Share on other sites More sharing options...
rag Posted July 30, 2020 Author Share Posted July 30, 2020 This works perfectly, thank you for your help! 1 Link to comment Share on other sites More sharing options...
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