0

Basically I made a little slideshow (don't know what else to call it) with Jquery on my website and I want it to keep looping through the animations until the user leaves the page? Here is my Jquery code

var t2 = setTimeout(function(){
$("#wantawebsite").delay(500).fadeIn(1000).delay(9500).fadeOut(1000);

$("#dontwanttopay").delay(1500).slideDown(1000).delay(8500).fadeOut(1000);

$("#thisistheplace").delay(3000).fadeIn(1000).delay(7000).fadeOut(1000);

$("#slideshowmonitor").delay(3300).fadeIn(1000).delay(6700).fadeOut(1000);

$( "#span1" ).delay(700).effect( "bounce", "slow" );

$( "#span2" ).delay(2300).effect( "bounce", "slow" );

$(".order").delay(2800).fadeIn(1000).delay(7200).fadeOut(1000);


}, 500);
var t3 = setTimeout(function(){
$("#werehiring").delay(500).fadeIn(1000).delay(9500).fadeOut(1000);

$("#applicationtext").delay(1500).slideDown(1000).delay(8500).fadeOut(1000);

$(".contactbutton").delay(3000).fadeIn(1000).delay(7000).fadeOut(1000);

$("#imageslide2").delay(3500).fadeIn(1000).delay(6500).fadeOut(1000);

  $(".contact").delay(2800).fadeIn(1000).delay(7300).fadeOut(1000);
}, 12500);

How exactly would I do this? Since making an infinite loop will just crash browser obviously.

4

1 回答 1

0

您应该将动画作为回调链运行,如下所示

$('#book').fadeIn(1000, function() {
   // next animation
});
于 2013-08-07T02:01:20.657 回答