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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:16:12+00:00 2026-05-16T21:16:12+00:00

As per my previous question , I have a working animation which fades in

  • 0

As per my previous question, I have a working animation which fades in and out each element within the div slideshow. The problem is that I want this animation to continue from the beginning once it has reached the last element. I figured that was easy and that I’d just place an infinite loop inside my JQuery function, but for some reason if I insert an infinite loop, no animation displays and the page hangs. I also cannot find anything in the documentation about how properly place a callback. How can I get this code to restart from the beginning of the animation once it finishes iterating over each object and why is an infinite loop not the right way to go about this?

<div id="slideshow">
    <p>Text1</p>
    <p>Text2</p>
    <p>Test3</p>
    <p>Text4</p>
</div>

<script>
$(document).ready(function() {

var delay = 0;
$('#slideshow p').each(
    function (index, item)
    {
        $(this).delay(delay).fadeIn('slow').delay(800).fadeOut('slow');
        delay += 2200;
    }
);

});
</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-05-16T21:16:13+00:00Added an answer on May 16, 2026 at 9:16 pm

    You could do something like this:

    $(function() {
      var d = 2200;
      function loopMe() {
        var c = $('#slideshow p').each(function (i) {
                  $(this).delay(d*i).fadeIn('slow').delay(800).fadeOut('slow');
                }).length;
        setTimeout(loopMe, c * d);
      }
      loopMe();
    });
    

    You can give it a try here.

    Instead of keeping up with a delay, you can just multiple it by the current index in the loop…since the first index is 0, the first one won’t be delayed at all, then 2200ms times the amount of elements later, do the loop again. In the above code d is the delay, so it’s easily adjustable, and c is the count of elements.

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

Sidebar

Related Questions

Have successfully gotten the csrf middleware working in express as per previous SO questions.
Per a great answer from another question I have begun mounting global resources (css/js/images)
With the help from two previous questions, I now have a working HTML scraper
I'm implementing a table per subclass design I discussed in a previous question .
This question is in continuation to my previous question, in which I asked about
Per an answer to a previous question (answer here: SQL/Database Views in Grails ),
Following my previous question . I have a table named activity with 2 columns:
This is closely related to a previous question i asked. I have a many-to-many
As per a previous question I've run into a bit of a bug laying
As per a previous question I'm setting up the HMVC extension for codeigniter. https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home

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.