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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:01:53+00:00 2026-05-23T19:01:53+00:00

How can I loop this. I tried different ways already but still faild. Like

  • 0

How can I loop this. I tried different ways already but still faild. Like setInterval(), while(). Could someone help me?

<div id="tablediv">
    <table border=1 height=850 width=1200>
        <tr><td >1</td><td >2</td><td>3</td></tr>
        <tr><td  width=300 height=400>4</td>
        <td >
            <div id="banner">
                    <div id="div1">
                        <p>This is the first page.</p>
                    </div>
                    <div id="div2">
                        <p>This is the second page.</p>
                    </div>
                    <div id="div3">
                        <p>This is the third page.</p>
                    </div>
                    <div id="div4">
                        <p>This is the fourth page.</p>
                    </div>
            </div>
        </td>
        <td width=300 height=400>5</td>
        </tr>
        <tr><td>6</td><td>7</td><td>8</td></tr>
    </table>
</div>


<style>
body{
overflow: hidden;
}

#tablediv{
width: 1200px;
height: 850px; 
margin: 0 auto;
}

#banner{
background-color: #e1e1e1;
position: relative;
width: 600px;
height: 400px;
}

#div1{
width:600px;
height:400px;
background-color: #fc3;
position: absolute;
top: -400px;
}
#div2{
width:600px;
height:400px;
background-color: #cc3;
position: absolute;
top: -400px;
}
#div3{
width:600px;
height:400px;
background-color: #cf3;
position: absolute;
top: -400px;
}
#div4{
width:600px;
height:400px;
background-color: #ff3;
position: absolute;
top: -400px;
}
</style>

<script src="jquery.js"></script>
<script>
$(document).ready(function(){   

    $("#div1").animate({
        top: "0px"
    }, 1000).delay(2000).animate({
        top: "400px",
    }, 1000);
    $("#div1").queue(function(){
        $(this).css("top", "-400px");
        $(this).dequeue();
    });
    $("#div2").delay(3000).animate({
        top: "0px"
    }, 1000).delay(2000).animate({
        top: "400px"
    }, 1000);
    $("#div2").queue(function(){
        $(this).css("top", "-400px");
        $(this).dequeue();
    });
    $("#div3").delay(6000).animate({
        top: "0px"
    }, 1000).delay(2000).animate({
        top: "400px"
    }, 1000);
    $("#div3").queue(function(){
        $(this).css("top", "-400px");
        $(this).dequeue();
    });
    $("#div4").delay(9000).animate({
        top: "0px"
    }, 1000).delay(2000).animate({
        top: "400px"
    }, 1000);
    $("#div4").queue(function(){
        $(this).css("top", "-400px");
        $(this).dequeue();
    });
});
</script>

when I put all the js inside

setInterval(function(){
  //script
});

the page will mess up. It seems only work for two animations.
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-23T19:01:54+00:00Added an answer on May 23, 2026 at 7:01 pm

    Just making sure, but you are putting all of the code inside of the document.ready in setInterval right?

    Eg:

    $(document).ready(function(){
        setInterval( function() {
            /* MEAT!!! (what you had in document.ready) */
        }, 1000 ); // close setInterval and tell it to use a 1 second delay.
    }); // close document.ready
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I can loop through a list of strings like this: list<string>::iterator Iterator;
I know their are already some optimize for loop questions, but I think this
I've already tried using many different techniques with this... One that works pretty nicely
How can I loop through this json data without referring to the data items
/// \todo Loop must be rewritten ... /// \todo Delete this loop Can Doxygen
can I do this in a loop, by producing the file name from the
How can I do this cleanly without gotos? loop: if(condition1){ something(); } else if
With an array $s_filters that looks like this (many different keys possible): Array (
Okay I've tried multiple things and looked for answers to this and I can't
I have a string array variable called 'myAttachmentArray[]' which holds different figures like this:

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.