Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: animated, continuous loop through children

Close but not quite there. I'd like to have the first child div displayed for a couple seconds, slide down (via positioning) and fade out of view, then the next child slide up and fade into view. Repeat continuously, looping back after the last child is displayed.

Looks like I've got the loop working though the count seems to pile the child divs on top of each other. What am I doing wrong?

http://jsfiddle.net/rrbaker/Xmk2y/4/

like image 302
rrbaker Avatar asked Nov 01 '11 03:11

rrbaker


3 Answers

Here's my remix: http://jsfiddle.net/ddrace/DJuV7/1/

I rearranged some things to make it more understandable and added settings for the pause and animation to keep it DRY and easier to tweak.

like image 173
ddrace Avatar answered Nov 02 '22 13:11

ddrace


Does this look ok http://jsfiddle.net/Xmk2y/5/

I removed the delay , set i = 0 and swapped top values.

like image 2
Birey Avatar answered Nov 02 '22 13:11

Birey


http://jsfiddle.net/Quincy/Xmk2y/8/

Just using the complete callback to recursively invoke nextQuote

like image 2
Quincy Avatar answered Nov 02 '22 15:11

Quincy