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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:02:00+00:00 2026-05-25T18:02:00+00:00

So I have a div that can have several divs inside of it. Something

  • 0

So I have a div that can have several divs inside of it. Something like:

<div id="news">         
    <span>Latest News!</span>       
    <div>
        //News 1    
    </div>
    <div>
        //News 2
    </div>
</div>

What I’m trying to do is on page load, the first div is visible, then after so many seconds, it fades out and the second div fades in. Pretty simple with fadeIn and fadeOut but I have to specifiy each div’s actions. Is there a way to say ‘Toggle between every div inside my #news div’? This way I can add new divs without having to add code to hide/show them?

Thanks!

  • 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-25T18:02:01+00:00Added an answer on May 25, 2026 at 6:02 pm

    Try the following

    $(document).ready(function() {
        $('#news div:gt(0)').hide();
    
        var swap = function(item) {
            setTimeout(function() {
                $(item).fadeOut(1000, function() {
                    var next = $(item).next()[0];
                    if (!next) {
                        next = $('#news div')[0];
                    }
    
                    $(next).fadeIn(1000, function() {
                        swap($(this)[0]);
                    })
                        });
            }, 1000);
    
        };
    
        swap($('#news div')[0]);
    });
    

    Fiddle: http://jsfiddle.net/9gwzt/2/

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

Sidebar

Related Questions

I have several divs that I want to work with dynamically. <div class=parent-19 id=123>
I have several links that points to a single AJAX url. I can load
I have several divs that are shown and hidden. How can I detect on
I would like to do something with several div's inside ul li: JsFiddle I'm
I have several divs on a page. Each div has a heading which I
I have a div that can have various heights based on the size of
I have a div that contains 3 fields You can see the image here
So I have a Div containing an iframe that I can Clone using JQuery.
I have code that uses jquery.slideup and jquery.slidedown How can i know that div
I have some HTML that looks like this: <div class=MyClass></div> <div class=MyClass></div> <div class=MyClass></div>

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.