我正在尝试延迟打开彩盒,但如果出现延迟,它根本不会运行。我尝试了很多东西,但是我被困住了。任何人都知道如何在第一个动画运行时让colorbox暂停?这是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"});
;})
答案 0 :(得分: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);