0

カラーボックスが開くのを遅らせようとしていますが、遅延が存在する場合はまったく実行されません。私はたくさんのことを試みましたが、行き詰まっています。最初のアニメーションの実行中にカラーボックスを一時停止する方法を知っている人はいますか?6000msですが、カラーボックスは3000msから始めたいです。

ありがとう!

これは機能します:

  $(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 に答える