0

我正在尝试延迟打开颜色框,但如果存在延迟,它根本不会运行。我已经尝试了很多东西,但我被卡住了。任何人都知道如何在第一个动画运行时让颜色框暂停?这是 6000 毫秒,但我希望彩盒从 3000 毫秒开始。

谢谢!

这有效:

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

这有效,但延迟为 0ms:

  $(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"});
;})
4

1 回答 1

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);
于 2012-05-24T01:26:40.853 回答