我有以下代碼切換一些全屏幕背景圖像(fadeout,fadeIn)。在兩個jQuery動畫中間執行代碼?
setInterval(function() {
var id = parseInt($('img.active').attr('id').substring(3,4));
var id_next = id;
switch(id) {
case 0:
id_next = 1;
break;
case 1:
id_next = 2;
break;
case 2:
id_next = 0;
break;
}
$('img.active').fadeOut('slow', function() {
$('img#bg_' + id).removeClass('active');
$('div.start-headline h1').html(hl[id]);
$('div.start-headline h2').html(sl[id]);
});
$('img#bg_' + id_next).fadeIn('slow', function() {
$('img#bg_' + id_next).addClass('active');
$('div.start-switches div').removeClass('active');
$('div.start-switches div#' + id).addClass('active');
});
}, 6000);
我怎麼能知道這個代碼,它應該在這兩個衰落的中間執行這兩條線
$('div.start-headline h1').html(hl[id]);
$('div.start-headline h2').html(sl[id]);
?現在它執行後的圖像褪色...
在此先感謝!
你想在淡出結束和淡入淡出即將開始之後進行干預嗎? –
當淡出完成並淡入開始的時候,是的! – Tronic