Share Posted February 7 The topic has the same context as this one and that one, but is not directly connected to those, as far as I can tell. It occurs on desktop Windows Chrome and Firefox, as well as Mac Safari. I did not verify other platforms, but have no reason to suspect that it is platform related. The CodePen is as minimal as I could make it without making is useless for me. It is in Typescript, which makes it a lot easier to read for me, unfortunately I'm aware that most others don't see it that way—even if I changed the coding style it would have still been rather complex. In fact, I have a working version with the exact same code, except for three lines. So, probably working through all the code will not be necessary anyhow. To reproduce the issue, scroll to any other panel than the first, and then resize the window. Expected behavior: after a rebuild of the page, the same panel as before the resize should be shown. Actual behavior: the first panel is always displayed after a resize. What is going on: After a resize, ScrollTrigger is killed and newly built. Then an attempt is made to send the new ScrollTrigger to the equivalent position the old one was in before the resize. The function used is ScrollTrigger.scroll(toValue); Line 55 in the code. While this works in one version, it does not in the other version. (I'll post the working version in the follow-up post) The difference between those versions is the method of creating (and recreating) the ScrollTrigger, it is to be found in lines 65, 68, and 69. Simply going with the working version is not an option, as this version has issues on mobile Safari, which this version has not. Moreover, I'm convinced that ScrollTrigger.scroll() should work in this version of creating the ScrollTrigger, which is working fine in any other respect as far as I can tell. Therefore, I suspect that either I do something 'illegal' in my code, which I'm not yet aware of, or there is a bug in ScrollTrigger. See the Pen VwBNONV by iDad5 (@iDad5) on CodePen 1 Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now