StormCode Posted January 25, 2020 Share Posted January 25, 2020 I was just wondering if anyone has successfully got ScrollToPlugin (v3.0.5) to work with Angular 8. I have it working to a certain degree but it does not respect the vars in the tween. gasp.to(window, { delay: 0, duration: 10, ease: 'back', scrollTo: 978 } All that happens is a smoothScroll to 978. The 'ease' is ignored and strangely the 'delay' is 10secs which is what the duration is set to! My component contains:- import { gsap } from 'gsap/all'; import ScrollToPlugin from 'gsap/ScrollToPlugin'; constructor() { gsap.registerPlugin(ScrollToPlugin); } ngOnInit() { const plugins = [ScrollToPlugin]; } Thanks a lot if anyone can help!! Link to comment Share on other sites More sharing options...
GreenSock Posted January 25, 2020 Share Posted January 25, 2020 Welcome to the forums, @StormCode. I'm curious - do you have a reduced test case we can look at? Maybe in codepen or stackblitz.com? As for the ease, keep in mind that the browser won't allow you to scroll something beyond its max, so I wonder if that's why you think the "back" ease isn't working correctly. GSAP may very well be setting the scroll property correctly, but the browser may simply ignore values beyond a certain point. I'm sure a reduced test case will clear everything up and allow us to offer a solid answer. The whole 10-second delay thing has me very curious. Happy tweening! Link to comment Share on other sites More sharing options...
StormCode Posted January 25, 2020 Author Share Posted January 25, 2020 https://stackblitz.com/edit/angular-uvzo9a?file=src%2Fapp%2Fapp.component.ts Here you go thanks! OH! Its works now??!! well... in StackBlitz Link to comment Share on other sites More sharing options...
GreenSock Posted January 25, 2020 Share Posted January 25, 2020 Yeah, I was gonna say - it works perfectly for me. Am I missing something? 1 Link to comment Share on other sites More sharing options...
StormCode Posted January 25, 2020 Author Share Posted January 25, 2020 Hmmn Its works great on StackBlitz but not in my project. Must be something to do with the way I have things set up. I shall investigate and re-post. Cheers 1 Link to comment Share on other sites More sharing options...
StormCode Posted January 25, 2020 Author Share Posted January 25, 2020 I found out what was causing the problem.... I had html { scroll-behavior: smooth; } ... in my CSS ! I hope this helps somebody else See it in action here:- https://stackblitz.com/edit/angular-uvzo9a?file=src%2Fstyles.css 1 1 Link to comment Share on other sites More sharing options...
GreenSock Posted January 25, 2020 Share Posted January 25, 2020 Thanks for letting us know! It may certainly help someone else down the road. 👍 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