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 7552657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:50:12+00:00 2026-05-30T10:50:12+00:00

Possible Duplicate: How can I make setInterval also work when a tab is inactive

  • 0

Possible Duplicate:
How can I make setInterval also work when a tab is inactive in Chrome?

http://www.datingjapan.co

I have setInterval changing images as follows:

    var initialFadeIn = 1000;           //initial fade-in time (in milliseconds)
    var itemInterval = 6000;            //interval between items (in milliseconds)
    var fadeTime = 2500;                    //cross-fade time (in milliseconds)

    var infiniteLoop = setInterval(function(){
        position1.eq(currentItem1).fadeOut(fadeTime);
        if(currentItem1 == numberOfItems1 -1) {currentItem1 = 0;}else{currentItem1++;}
        position1.eq(currentItem1).fadeIn(fadeTime);
    }, itemInterval);

I notice when I move between browser tabs in Chrome that when I come back to the site (after the interval has passed) the images quickly jump to the next. Is it possible to make this smoother? or make this occur in the background?

any info on this would be great.

thx

  • 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-05-30T10:50:14+00:00Added an answer on May 30, 2026 at 10:50 am

    It happens with setInterval but not with setTimeout. Trick is to use a recursive function instead of setInterval. Call the function as callback of last animation

    function infiniteLoop() {
        setTimeout(function() {
            position1.eq(currentItem1).fadeOut(fadeTime);
            if (currentItem1 == numberOfItems1 - 1) {
                currentItem1 = 0;
            } else {
                currentItem1++;
            }
            position1.eq(currentItem1).fadeIn(fadeTime, infiniteLoop);
        }, itemInterval);
    }
    
    infiniteLoop();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can a JavaScript object have a prototype chain, but also be a
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: Can I just make up attributes on my HTML tags? Hi, I
Possible Duplicate: Android - shadow on text? How can i make shadow effect text
Possible Duplicate: java PreparedStatement Can I make the prepared statement SELECT * FROM STUDENTS
Possible Duplicate: In JavaScript can I make a “click” event fire programmatically for a
Possible Duplicate: How can I upload files asynchronously with JQuery? I have a file
Possible Duplicate: Can I set a breakpoint on 'memory access' in GDB? I have
Possible Duplicate: Java: how to clone ArrayList but also clone its items? I have
Possible Duplicate: PHP: running scheduled jobs (cron jobs) How can I make my PHP

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.