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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:46:03+00:00 2026-06-18T11:46:03+00:00

Based om some earlier questions I try to run my function a infinite number

  • 0

Based om some earlier questions I try to run my function a infinite number of times.
But still it doesn’t work.
If I run the script, it get broken on strange moments en before running the script again there is a long interval.
Can anyone help me to get this script running without intervals and stops?
Thanks.

<script type="text/javascript">
$("#go").hide().ready(function(){
animatie();
});
var d = 0;
function animatie() {
 for(var i = 0; i < 3; ++i){
  var b = ".block"+i;
  $(b).hide().delay(d).fadeIn(2000);
  $(b).hide().delay(1000).fadeOut(2000);
  d += 4000;
 }
}
window.setInterval(animatie, 13000);
</script>
  • 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-06-18T11:46:05+00:00Added an answer on June 18, 2026 at 11:46 am

    You probably want to reset d to 0 each time the setInterval triggers. Also, maybe the 4000 should be 5000 instead (2000 + 1000 + 2000). Lastly, you don’t need to .hide() twice: http://jsfiddle.net/nZHCB/.

    function animatie() {
     var d = 0;
     for(var i = 0; i < 3; ++i){
      var b = ".block"+i;
      $(b).hide().delay(d).fadeIn(2000).delay(1000).fadeOut(2000);
      d += 5000;
     }
    }
    animatie();
    window.setInterval(animatie, 15000);
    

    That said, you can also use one function to iterate over an element. When the last animation (.fadeOut) is done, call the function again with the next element: http://jsfiddle.net/nZHCB/2/.

    $("div").hide();
    
    (function animatie(i) {
        var b = ".block" + i;
        $(b).fadeIn(2000).delay(1000).fadeOut(2000, function() {
            animatie((i + 1) % 3);
        });
    })(0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question earlier, but I changed the table structure based on recommendations.
Based on some answers to this question it appears that +alloc does some behind-the-scenes
I have a Person Class and based on some help I received in this
got a weird question for you based on some weird happenings on our site.
I have the following requirement: Based on some user input, I need to generate
Hi I write some code to hide and show some based on the selected
I want to toggle a class based on some condition which I have to
I want to invalidate sessions of users based on some Event. I store their
I have a library I am creating based on some WSDL/XSD definitions. I am
My application requires events to be fired based on some specific activities that happen.

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.