Cassie Posted April 4 Share Posted April 4 Hey, I'm not really sure why this would make a difference unless either the text coming from the backend is dynamically injected later than page load or the class itself is added later? My guess would be that the fonts are loading later and causing a layout shift? maybe... document.fonts.ready.then(function () { ScrollTrigger.refresh() }); If this doesn't help please give us a demo showing the issue. Thanks Link to comment Share on other sites More sharing options...
Nick.Ls Posted April 4 Author Share Posted April 4 18 minutes ago, Cassie said: document.fonts.ready.then(function () { ScrollTrigger.refresh() }); I am executing the entire splitting / animation function on document loaded. document.addEventListener('DOMContentLoaded', function() { Shouldn't this be include the fonts loaded? Thanks! Link to comment Share on other sites More sharing options...
Cassie Posted April 4 Share Posted April 4 Not always no, it's dependent on your font loading strategy https://stackoverflow.com/questions/25223470/does-domcontentloaded-wait-for-web-fonts-firefox#:~:text=NO%2C it does NOT!,to make it pixel perfect.&text=inside the head (it's called browser preload hints). 2 Link to comment Share on other sites More sharing options...
Nick.Ls Posted April 4 Author Share Posted April 4 I am preloading the fonts to be honest but I will set the animations based on that and see what happens. For the time being I have a workaround already for my scenario. Thank you once again! 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