2012-05-23 18 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);