Solved

Loop chained effects in jQuery

Posted on 2010-11-11
2
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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)
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 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