2012-05-23 32 views
0

我試圖延遲彩盒打開,但如果延遲出現,它根本不運行。我嘗試了很多東西,但我被卡住了。任何人都知道如何讓第一個動畫運行時,讓colorbox暫停?它是6000毫秒,但我希望彩盒在3000毫秒開始。延遲彩盒在另一個動畫期間啓動

謝謝!

這工作:

$(document).ready(function(){ 
    $('a[data-test]').click(function(){ 
    var anim = $(this).attr('data-test'); 
    buttonAnim(anim); 
    $.colorbox({href:"contact/index.html"}); 
;}) 

這工作,但0毫秒的延遲:

$(document).ready(function(){ 
    $('a[data-test]').click(function(){ 
    var anim = $(this).attr('data-test'); 
    buttonAnim(anim); 
    $('a[data-test]').delay(3000).colorbox({href:"contact/index.html"}); 
;}) 

回答

0

嗯,我不知道顏色框的插件,但也許你可以使用一些技巧,如:

$(document).ready(function(){ 
    $('a[data-test]').click(function(){ 
    var anim = $(this).attr('data-test'); 
    buttonAnim(anim); 
    $("#divOfYourChoice").animate({'height': $("#divOfYourChoice").height()},3000, 
    function($('a[data-test]').colorbox({href:"contact/index.html"});) 
    ); 
;}) 

其中divOfYourChoice是其名稱表示頁面上的任何div的名稱。當然,這不是最優雅的解決方案,但它應該無論如何工作。希望這可以幫助你解決你的問題(直到找到一個更好的解決方案)

可選您可以使用setTimeout的,如:

setTimeout(function($('a[data-test]').colorbox({href:"contact/index.html"});),3000);