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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:44:44+00:00 2026-05-27T16:44:44+00:00

At the moment I have the following html structure on a feature section: <ul>

  • 0

At the moment I have the following html structure on a feature section:

<ul>
    <li>
        <ul>
            <li title="#tab1">Featured 1</li>
            <li title="#tab2">Featured 2</li>
            <li title="#tab3">Featured 3</li>
        </ul>
    </li>
    <li>Item 2</li>
    <li>Item 3</li>
    <li>Item 4</li>
    <li>Item 5</li>
</ul>

The ‘Featured’ tabs have corresponding divs with hidden content, at default the first ‘Featured 1’ is loaded into the container to show off this featured content and 2 and 3 are display:none;

The other list items (‘Item 2’, ‘Item 3’, etc.) are loaded via jQuery load() on click into the feature container replacing whatever is currently in it and the same is done if a ‘Featured’ tab is clicked.

What I want to do is rotate the first 3 featured tabs related content on ready for say 5 seconds each until any of the tabs are clicked and then it should stop.

I was using .tabs to do this with ui.js and ui-tabs.js but it adds a lot of uneeded js code and it’s probably easier to do it with a custom function but I’m a little stumped as how best to do a timer based loop. With the .tabs() it was basically simulating a click to show the content but why not just loop through the content tabs whilst setting the related li class using addClass('clicked'); to show which is currently being shown.

To sum up I need the function to do the following pseudo code:

  1. On load
  2. FadeIn <div id=tab1"> and addClass(“clicked”); to <li title="#tab1">
  3. FadeOut <div id=tab1"> after 5 seconds and removeClass <li title="#tab1">
  4. FadeIn <div id=tab2"> and addClass(“clicked”); to <li title="#tab2">
  5. FadeOut <div id=tab2"> after 5 seconds and removeClass <li title="#tab2">
  6. FadeIn <div id=tab3"> and addClass(“clicked”); to <li title="#tab3">
  7. FadeOut <div id=tab3"> after 5 seconds and removeClass <li title="#tab3">
  8. Go back to step 2

If any ul li are clicked then stop the function from running.

  • 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-27T16:44:45+00:00Added an answer on May 27, 2026 at 4:44 pm

    Perhaps something like this?

    (function () {
        var current = 1;
        var total = 3;
    
        var gotoNext = function () {
            $('#tab' + current).fadeOut();
    
            if (current < total) {
                current++;
            }
            else {
                current = 1;
            }
    
            $('#tab' + current).fadeIn();
        };
    
        var interval = setInterval(gotoNext, 5000);
    
        $('ul li').click(function () {
            clearInterval(interval);
        });
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following structure in html5: html - body - header - #wrapper
I have the following HTML <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <style> .box {
I have the following HTML in a page feature: <div id=feature-detail> <div class=da1 d-active>
At the moment I have the following code which works fine. label = new
Got a bit of a mind freeze at the moment. I have the following
I just started using django for development. At the moment, I have the following
The following code summarizes the problem I have at the moment. My current execution
At the moment, I have a whole bunch of html + php files with
I have the following DOM structure: /*:DOC += <div id='testDiv' class='testDivClass'><div id='innerTestDiv'></div></div><span id='testSpan' class='testSpanClass'><span
I have the following jQuery (admittedly messy at the moment) which appends a new

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.