Solved

Loop chained effects in jQuery

Posted on 2010-11-11
2
461 Views
Last Modified: 2012-05-10
Hi.  
I am attempting to create a loop of elements that fade in and out (ie, a slideshow).  I understand how to use the callback function to control the timing of the fades, but how do i loop this?
It feels like a infinite regression.
Thanks,
Chip

$(document).ready(function(){

	$('div#slideshow').children().hide();

	fadeElement('div#slide1', function(){fadeElement('div#slide2');});

});



function fadeElement(elementName, f){   $(elementName).fadeIn(3000).delay(2000).fadeOut(3000, f);

	return;

}

Open in new window

0
Comment
Question by:nbccit
2 Comments
 
LVL 16

Accepted Solution

by:
jmatix earned 500 total points
ID: 34111962
See this page for a simple fadein slideshow using jQuery:

http://snook.ca/archives/javascript/simplest-jquery-slideshow

0
 

Author Comment

by:nbccit
ID: 34112183
Ahh.  Ok.  I saw something like this as I was looking for a solution.  The design flaw was trying to link the effects, rather than have a parent function call the event.  My unfamiliarity with JS meant I was unaware of the setInterval function.
Sounds like that is the way to go.  Thanks.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now