我有一組選項卡,這些選項卡會導致某些DIV選項在父DIV頂部「飛出」。內容通過AJAX提取。jQuery等到一個動畫完成之後纔開始另一個動畫
蒼蠅超時被稱爲上點擊像這樣
$('.fly_out').live('click', function() {
var $widget = $(this).closest('.widget');
var $flyOutIndex = $(this).index('.fly_out');
if ($flyOutIndex == 0) {
$flyOutURL = 'Content/HTMLSnippets/Flyouts/Priceassessment/product_order.htm';
} else if ($flyOutIndex == 1) {
$flyOutURL = 'Content/HTMLSnippets/Flyouts/PriceHistory/price_history_comparisons.htm';
} else if ($flyOutIndex == 2) {
$flyOutURL = 'Content/HTMLSnippets/Flyouts/PriceHistory/price_history_scenarios.htm';
} else if ($flyOutIndex == 3) {
$flyOutURL = 'Content/HTMLSnippets/Flyouts/PriceHistory/price_history_analysis.htm';
}
// Close any open flyouts
closeFlyout();
$.ajax({
type: 'GET',
url: DashboardApplicationRoot + $flyOutURL,
dataType: 'html',
cache: false,
success: function(data) {
$($widget).prepend(data);
$('.fly_container').animate({ 'right': '0' }, 'fast');
$('.scroll').jScrollPane();
$('.striped li:nth-child(even)').addClass('odd');
}
});
return false;
});
我有一個函數來關閉彈出按鈕:點擊時
function closeFlyout() {
$('.fly_container').animate({
'right': '-332'
}, 'fast', 'swing', function() {
$(this).detach();
});
};
當另一個飛出標籤被稱爲被點擊,也一個關閉按鈕包含在飛出本身:
$('.fly_container .close').live('click', function() {
closeFlyout();
return false;
});
我想分機結束這個動作,以便如果飛出來並且用戶點擊以初始化另一個飛出,則打開的飛出動畫關閉,但新的飛出等待此動畫完成,然後顯示新的飛出。