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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:37:36+00:00 2026-05-20T08:37:36+00:00

Experimenting with jQuery and trying to make a small slide show that rotates through

  • 0

Experimenting with jQuery and trying to make a small slide show that rotates through three images. Here’s my HTML:

<div id="slideShow">
    <img src="images/slides/slide1.jpg" width="520" height="230" />
    <img src="images/slides/slide2.jpg" width="520" height="230" />
    <img src="images/slides/slide3.jpg" width="520" height="230" />       
 </div>

And here’s the script:

$(function ()
{
    var $slides = $('#slideShow img').hide(),
    slideIndex = 0;

    slideTransition = function ()
    {
        slideIndex++;
        (slideIndex == $slides.length) ? slideIndex = 0: null;
        $slides.eq(slideIndex).fadeIn(3000);
        $slides.eq(slideIndex).fadeOut(3000,slideTransition);
    }

    $slides.eq(0).fadeIn(3000);
    $slides.eq(0).fadeOut(3000, slideTransition);

});

This actually works fine, but my gut is telling me that having the infinite recursion is a bad thing. Any suggestions on how to do this better?

  • 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-20T08:37:37+00:00Added an answer on May 20, 2026 at 8:37 am

    What you’re doing is not recursion. When the animation starts, your call returns. Then, a timer event handler invokes your method. Your solution is just fine.

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

Sidebar

Related Questions

I experimenting with jQuery. As I was trying I found out that I can't
I'm experimenting with the jQuery UI tab control, and have three tabs that each
I'm experimenting with jquery and svg, I make up my path but now I
I'm experimenting with TreeView plug-in located here: http://docs.jquery.com/Plugins/Treeview One of the options it has
I'm experimenting with a jQuery Mobile app that will eventually end up as a
I'm experimenting with the Tiny MCE editor. We also use jQuery, and I noticed
While experimenting with this question on collections in Spring.NET , I discovered that Spring
I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through
I'm experimenting with internationalization by making a Hello World program that uses properties files
I am finally experimenting and trying to learn MVC after years of asp.net. I

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.