Jump to content
Search Community

When switching to another tab and then back to the site, the script works strangely, why?

Manvel test
Moderator Tag

Recommended Posts

I needed to make sure that the text and video run synchronously and simultaneously, so I decided to do this.

The script starts working only when the video starts to go.
Everything works fine, but when you go to another tab, then back to the site, the script starts to work strangely and the text starts to print strangely.

See the Pen rNZBVRa by Undefend (@Undefend) on CodePen

Link to comment
Share on other sites

Browsers throttle requestAnimationFrame() and setTimeout() while a tab is inactive. GSAP automatically adjusts its timing mechanism to adjust things to pick up smoothly where they left off when there's a lag like that (typically a very helpful thing), but it sounds like in your particular scenario you don't want that. You can disable it like: 

gsap.ticker.lagSmoothing(false);

See https://greensock.com/docs/v3/GSAP/gsap.ticker

 

Does that help?

Link to comment
Share on other sites

16 hours ago, GreenSock said:

Browsers throttle requestAnimationFrame() and setTimeout() while a tab is inactive. GSAP automatically adjusts its timing mechanism to adjust things to pick up smoothly where they left off when there's a lag like that (typically a very helpful thing), but it sounds like in your particular scenario you don't want that. You can disable it like: 

gsap.ticker.lagSmoothing(false);

See https://greensock.com/docs/v3/GSAP/gsap.ticker

 

Does that help?

 

 

No(

Link to comment
Share on other sites

Sorry, but I have no way of seeing or understanding what you think the problem is. Can you please be very specific about exactly how to reproduce the problem? I can't read the language you used there and I don't know what to look for. Maybe try to post a different minimal demo that simply has some colors that change or numeric values that are easy to reference and then specify the steps to reproduce the issue. 

Link to comment
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...