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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:22:02+00:00 2026-05-27T22:22:02+00:00

I am creating my own carousel which moves one step to the left or

  • 0

I am creating my own carousel which moves one step to the left or right depending on what button was clicked. That part of the code works as expected hence i have not included it here

What i am unable to accomplish is to automate or rotate the carousel when the page loads up. That is after every 4 or 5 seconds the current active element should move to the next.

The code below shows my current attempt.

$('.promo-nav').show();
function rotate() {
    var showid = 0;   
    if(!$(this).parent().parent().hasClass('active')){              
        id = $(this).parent('li').index();              
        $(this).parent().parent().children('li.active').removeClass('active');
        $(this).parent().addClass('active');
        $(this).parent().parent().parent().parent().parent()
            .children('.promo-carousel-content').css({'display':'none'})
            .eq(id).css({'display':'block'});
    }
}
window.setTimeout(rotate, 400);

//css
.promo-carousel {display: block;} 
.content {display: none;}   
.content.first {display: block;}


//markup 
<div class="grid_4"> 
    <div class="promo-carousel"> 
        <div class="content first"> 
             //some content 
        </div> 
    </div> 
    <div class="promo-nav"> 
        <div> 
            <div class="prev"> 
                <a href="#"><span class="hide">previous</span></a> 
            </div> 
            <ul> 
                <li class="active"><a href="#"><span class="">first</span></a></li>
                <li><a href="#"><span class="">second</span></a></li>
                <li class="circle"><a href="#"><span class="">third</span></a></li>
                <li class="circle"><a href="#"><span class="">fourth</span></a></li>
            </ul>
            <div class="next"> 
                <a href="#" class=""><span class="hide">next</span></a>   
            </div>              
        </div>              
    </div>   
</div> 
  • 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-27T22:22:03+00:00Added an answer on May 27, 2026 at 10:22 pm

    Are you looking for something like this?

    $(document).ready(function() {
        $('.promo-nav').show();
        setInterval(rotate, 4000);
    
        function rotate() {
            var showid = 0;
            $('.promo-nav').find('li').each(function() {
    
                if ($(this).hasClass('active')) {
                    $(this).removeClass('active');
                    if ($(this).next().length == 0) {
                        id = $('.promo-nav').find('li:first-child').index();
                        $('.promo-nav').find('li:first-child').addClass('active');
                        $(this).closest('.promo-nav').prev('.promo-carousel').children('div.content').css({
                            'display': 'none'
                        });
                        $(this).closest('.promo-nav').prev('.promo-carousel').children('div.content').eq(id).css({
                            'display': 'block'
                        });
                        return false;
                    } else {
                        id = $(this).next().index();
                        $(this).next().addClass('active');
                        $(this).closest('.promo-nav').prev('.promo-carousel').children('div.content').css({
                            'display': 'none'
                        });
                        $(this).closest('.promo-nav').prev('.promo-carousel').children('div.content').eq(id).css({
                            'display': 'block'
                        });
                        return false;
                    }
                }
            });
        }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating my own recipe box using php/mysql and one part I'm stuck on
I am creating my own jQuery plugin. Here is the code which I have
I'm creating my own Facebook button by using the following istructions: http://www.kimwoodbridge.com/how-to-create-your-one-facebook-share-url/ However my
I am creating my own custom T4 Template that integrates with an ADO.NET Entity
I'm creating my own RSS Reader, and to see which RSS items were already
I am interested in creating my own mobile OS. I read that the existing
I'm creating my own skin for subtext, and there's one thing I can't figure
When creating my own macro, and trying to add it so that anyone can
I'm creating my own JavaScript Array-like object and I have methods that call closures.
I'm creating my own template engine using PHP. The basic idea is that for

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.