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

  • Home
  • SEARCH
  • 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 6921133
In Process

The Archive Base Latest Questions

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

My image rotation works fine when the focus is on that page(I am using

  • 0

My image rotation works fine when the focus is on that page(I am using Google Chrome). But when I open another tab and view some other page, and when I return back to my page(clicks on the tab that has my page loaded), the image rotation is somewhat speedy !

I use fadeIn() and fadeOut() to show and hide images. Also, the code for this is enclosed in another function which is initiated using setTimeout() on $(document).ready() and a setTimeout() is used in the end of the function too (the function that I mentioned previously).

How to solve this ?

EDIT

Code used:

    var initialFadeIn = 1000;
    var itemInterval = 5000;
    var fadeTime = 2500;
    var numberOfItems = 0;
    var currentItem = 0;

    $(document).ready(function() {

        numberOfItems = $('.banner-img').length;
        $('.banner-img').eq(currentItem).fadeIn(initialFadeIn);

        var imgTitle = $('.banner-img').eq(currentItem).attr('title');
        $('.banner-title').text(imgTitle);

        setTimeout(imgLoop, itemInterval);

    });

    function imgLoop()
    {
        $('.banner-img').eq(currentItem).fadeOut(fadeTime);

        if(currentItem == numberOfItems -1){
            currentItem = 0;
        }else{
            currentItem++;
        }
        $('.banner-img').eq(currentItem).fadeIn(fadeTime);

        imgTitle = $('.banner-img').eq(currentItem).attr('title');
        $('.banner-title').text(imgTitle);

        setTimeout(imgLoop, itemInterval);
    }
  • 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-27T10:14:13+00:00Added an answer on May 27, 2026 at 10:14 am

    Solution:

    As turzifer suggested, I used cycle plugin: http://jquery.malsup.com/cycle/

    And to display captions above the image, I used:

    <script type="text/javascript">
    $(function() {
    $('#slideshow').cycle({
        fx:       'fadeZoom',
        timeout:   2000,
        before:     function() {
            $('#caption').html(this.alt);
        }
    });
    });
    </script>
    

    Like in this example: http://jquery.malsup.com/cycle/caption.html (view page source to see the code)

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

Sidebar

Related Questions

I am using those codes for rotation transforming an image, but it doesn't work.
I want to rotate an image continuously on page load. Code works fine for
I have an UIImageView which I can rotate using CABasicAnimation . That works fine.
I am doing a simple card rotation which works fine, but when I add
How can one image be rotated with axis of rotation as image centre using
I'm using the following code to rotate an image http://www.platinumball.net/blog/2010/01/31/iphone-uiimage-rotation-and-scaling/ that's one of the
I want to turn an image 190 degrees when pressing a button. That works
I'm trying to rotate an image around the center. This works generally using RotateAnimation,
I am working on animating an image view and that moves to the right
I am using XNA to do rotation of an image. I want it to

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.