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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:58:10+00:00 2026-05-27T08:58:10+00:00

I have a slideshow named rotatePics() that begins on pageload. I also have a

  • 0

I have a slideshow named rotatePics()that begins on pageload. I also have a number of li‘s that when clicked, will get the rel value of that li. The rel‘s of the li‘s match up with the id‘s of the preloaded slideshow images. So when one is clicked, I want to stop the current slideshow function named rotatePics and restart it but parsing a new integer.

Currently what is happening, is that I am able to run the NEW slideshow function, but not replace the slideshow function that runs when the page loads.

I need to stop rotatePics() and restart it with the variable number with only the latter function running.

$('a.main-img').click(function (e)
{
    e.preventDefault();

    var clickedLi = $(this).closest('li').attr('rel');

    var number = parseInt(clickedLi);

    rotatePics(number);

});

This is the code for the rotatePics() function

    function rotatePics(currentPhoto){

    var numberOfPhotos = $('#banner-holder img').length;

    currentPhoto = currentPhoto % numberOfPhotos;

    $('#banner-holder img').eq(currentPhoto).fadeOut(function (){
        $('#banner-holder img').each(function (i)
        {
            $(this).css('zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos);
        });

        $(this).show();

        setTimeout(function ()
        {
            rotatePics(++currentPhoto); 
        }, 1000);
    });
};

I am also aware that the modulus section changes the integer, This was originally just a rolling slideshow and without the option to select new images.

  • 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-27T08:58:11+00:00Added an answer on May 27, 2026 at 8:58 am

    Clear your timeout as follows:

    var rotatePicsTimer;
    function rotatePics(currentPhoto){ 
    
        var numberOfPhotos = $('#banner-holder img').length; 
    
        currentPhoto = currentPhoto % numberOfPhotos; 
    
        $('#banner-holder img').eq(currentPhoto).fadeOut(function (){ 
            $('#banner-holder img').each(function (i) 
            { 
                $(this).css('zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos); 
            }); 
    
            $(this).show(); 
    
            rotatePicsTimer = setTimeout(function () 
            { 
                rotatePics(++currentPhoto);  
            }, 1000); 
        }); 
    };
    
    $('a.main-img').click(function (e)   
    {   
        e.preventDefault();   
    
        var clickedLi = $(this).closest('li').attr('rel');   
    
        var number = parseInt(clickedLi);   
    
        clearTimeout(rotatePicsTimer);
        rotatePics(number);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this slideshow that I'm trying to simply move up, but I can't
I have a slideshow built in flash that I want to mimic in jQuery.
I have a Flash slideshow that plays SWFs listed in an XML file. I
I have a slideshow that has 5 slides (each has an individual id) and
Right now, we have a slideshow of images that uses javascript. However, when the
I have created a slideshow widget, using jQuery.UI widgets that works with window.setInterval. I
I have a Jquery Cycle slideshow that has a click function to animate a
I have a slideshow of pictures that I am trying to center align. Right
I have slideshow, and I want to show Big images, I added to [NSOperation
I have created slideshow in my app and caching images in CacheDirectory of iPhone

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.