Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8352767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:03:48+00:00 2026-06-09T09:03:48+00:00

I have an animated text effect with jquery that works fine in chrome and

  • 0

I have an animated text effect with jquery that works fine in chrome and ie but breaks in firefox when the user switches tabs. If you switch tabs and let the animation run for 10-15 seconds, then go back you can see the animation tries to run multiple lines at once.

I have tried using a conditional for $(window).blur() and $(window).focus() as well as a clearInterval function with no luck at all.

Here is a link to the site

Here is the jquery in question:

 $(document).ready(function(){
$('.container .flying-text').css({opacity:0});
$('.container .active-text').animate({opacity:1, marginLeft: "350px"}, 4000);
var int = setInterval(changeText, 5000);    

 function changeText(){
var $activeText = $(".container .active-text"); 

var $nextText = $activeText.next(); 
if($activeText.next().length == 0) $nextText = $('.container .flying-text:first');

$activeText.animate({opacity:0}, 200);
$activeText.animate({marginLeft: "-100px"});

$nextText.css({opacity: 0}).addClass('active-text').animate({opacity:1, marginLeft: "350px"}, 4000, function(){

    $activeText.removeClass('active-text'); 
    });
  }

 });

the html:

<div class="container">
    <h3 id="fly1" class="flying-text active-text">Creative Solutions</h3>
    <h3 id="fly2" class="flying-text">Graphics</h3>
    <h3 id="fly3" class="flying-text">Sourcing</h3>
    <h3 id="fly4" class="flying-text">Distribution</h3>
    <h3 id="fly5" class="flying-text">Online Tools</h3>
    <h3 id="fly6" class="flying-text">Custom Branding</h3>
    <h3 id="fly7" class="flying-text">Personalized Support</h3>
</div>

and the css:

.flying-text{
  margin-left:-100px;
  font-size:60px;
  text-align:center;
  font-style:bold;
}

Any Ideas on possible fixes? I know the browser renders the animation at a slower rate in an inactive tab, but i can’t seem to be able to target the animation and stop/resume it on a switched tab.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:03:49+00:00Added an answer on June 9, 2026 at 9:03 am

    I think it is intended by jQuery to NOT run if the window is not visible (focus is not necessary)
    It does so by using window.requestAnimationFrame
    Why? Because it saves performance if you cannot see the animation.
    The animation values are calculated in the background I think, but not the actual rendering of the elements.


    The problem with your animation is: You call the change text via a interval. The interval is independent of the animation. If you stop/pause the jquery animation, because you blur the window, the timeout will not stop.

    What you need to do.
    Make a function nextText, that changes the text and a function startAnimation that starts the animation. And a function stopAnimation that stops the animation.
    Don’t use a interval.
    Onblur you stop the animation by calling stopAnimation
    Onfocus you start the animation by calling startAnimation
    After loading you call startAnimation once
    After the animation is finished you call the function nextText
    nextText calls startAnimation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a hover effect on a image. That works fine! But
I have a horizontal animated menu that has a strange behavior because it works
I have the following jQuery script that makes an orange transparent hover effect cover
I have a animated GIF that I want as a watermark. How do I
I have an animated gif image that gets swapped to another animated gif onclick.
So, I have an animated drop down menu that slides down when your mouse
I have a question regarding jQuery. I have multiple images that are, in essence,
I am trying to get a simple effect working in jQuery, and only have
I am using the .animate function in Jquery. I have a div that slides
I am trying to create a small animated effect with jquery in which images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.