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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:30:32+00:00 2026-05-27T14:30:32+00:00

HTML <div id=slides> <div id=one>Slide 1</div> <div id=two>Slide 2</div> <div id=three>Slide 3</div> </div> CSS

  • 0

HTML

<div id="slides">  
    <div id="one">Slide 1</div>  
    <div id="two">Slide 2</div>  
    <div id="three">Slide 3</div>  
</div>

CSS

#slides .show{
    display: block;
}
#slides div{
    display: none;
}

Script

var slides = $('#slides').children();

var i = 0;
function play(){
    $(slides[i]).addClass('show');
    setTimeout($(slides[i]).removeClass('show'), 500); /* does nothing */
    i++;
    setTimeout(play, 3000); 
}

play();

I got this and it displays the slide one by one but it doesn’t remove them. Wondering how to set the removeClass to wait for a second before actually removing it.

UPDATED jsfiddle link below

http://jsfiddle.net/WbsxQ/6/

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-27T14:30:33+00:00Added an answer on May 27, 2026 at 2:30 pm

    When setTimeout fires your loop has been finished long time ago. Try putting the element slides[i] – into global variable (you don’t need another $ there).

    elementToHide = slides[i];
    setTimeout(function(){elementToHide.removeClass('show')}, 500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$(this).parent().parent() .children(this.attr(tagName).toLowerCase()) .css(background-color, yellow); xpath: /html/body/div/table/tr/td/b/a $(this).tagName is Anchor <a> the problem with this
I am using the following sliding div script: http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html Currently, the slidetoggle function is
I have some HTML and jQuery that slides a div up and down to
I'm trying to create a small html fragment (a div element) consisted of three
I have a slide show which is made up of a divs. Each Div
I have two Javascript scripts on a site. One is an accordion (show/hide) and
I setup three sliders. One is a range, and the other two are regular.
I am trying to generate an html div in asp.net. Since a div is
What is the best way to set the transparency of a HTML DIV element
how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul

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.