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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:44:37+00:00 2026-06-12T09:44:37+00:00

Im using a script to rotate through various images stored in an un-ordered list.

  • 0

Im using a script to rotate through various images stored in an un-ordered list. The script is working, but seems to remove preset classes applied to a specific Li. I want the script to work exactly as it is currently, but not remove a class that I set on an Li. Can someone offer some suggestions or modifications? Thank you. See the example fiddle here:

http://jsfiddle.net/trobbins26/5U4Cr/5/

Or script below:

function theRotator() {
        //Set the opacity of all images to 0
        $('div.rotator ul li').css({opacity: 0.0});

        //Get the first image and display it (gets set to full opacity)
        $('div.rotator ul li:first').css({opacity: 1.0});

        //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds

        setInterval('rotate()',4000);

        }

        function rotate() {    
        //Get the first image
        var current = ($('div.rotator ul li.show')?  $('div.rotator ul li.show') : $('div.rotator ul li:first'));

        if ( current.length == 0 ) current = $('div.rotator ul li:first');

        //Get next image, when it reaches the end, rotate it back to the first image
        var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first'));

        //Un-comment the 3 lines below to get the images in random order

        //var sibs = current.siblings();
        //var rndNum = Math.floor(Math.random() * sibs.length );
        //var next = $( sibs[ rndNum ] );


        //Set the fade in effect for the next image, the show class has higher z-index
        next.css({opacity: 0.0})
        .addClass('show')
        .animate({opacity: 1.0}, 500);

        //Hide the current image
        current.animate({opacity: 0.0}, 1000)
        .removeClass('show');

        };
setTimeout(function(){
        $(document).ready(function() {        
            //Load the slideshow
            theRotator();
            $('div.rotator').fadeIn(500);
            $('div.rotator ul li').fadeIn(500); // tweek for IE
        });
        }, 500);
  • 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-12T09:44:38+00:00Added an answer on June 12, 2026 at 9:44 am

    This script is not the problem, you must have another script stripping out the classes. I must mention, however, that you do not currently have any “preset” classes on your list items currently. The only class being applied is the “show” class which is expected. This class is properly being removed, also as expected.

    I’ve reproduced your slider with two classes (that offer background colors for emphasis) to demonstrate that this does indeed work. I did not change any of the jquery.

    View the demo here: http://fluidev.com/stack/rotate.html

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

Sidebar

Related Questions

I have a script I'm using to rotate images in an un-ordered list (LI).
I am using a simple little jQuery script to rotate through some images. I'm
I'm currently using a small jquery script to rotate through background images on a
Everything seems fine when using script as #/bin/sh on ubuntu but now on using
Using Script Task, I had stored data ie a Dataset or Datatable object to
I'm using a php script to randomly show images. I've duplicated this script three
using the script code below, this returns the images from facebook vertically. ive removed
I am making this script that will rotate a needle on a tachometer using
here's a description of the issue I'm having: The following script will rotate through
This should be simple.. but can't figure out : I am using rotate function

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.