jQuery循环插件幻灯片延迟到onBefore完成
我已经尝试了我能想到的一切,但我似乎不能延迟jQuery循环插件的幻灯片,直到我的onBefore中的动画完成。我尝试过使用delay()和setTimeout()以及cycle('toggle')。有人对如何将下一张幻灯片推迟到onBefore中的所有内容完成有什么想法吗jQuery循环插件幻灯片延迟到onBefore完成,jquery,plugins,timeout,cycle,Jquery,Plugins,Timeout,Cycle,我已经尝试了我能想到的一切,但我似乎不能延迟jQuery循环插件的幻灯片,直到我的onBefore中的动画完成。我尝试过使用delay()和setTimeout()以及cycle('toggle')。有人对如何将下一张幻灯片推迟到onBefore中的所有内容完成有什么想法吗 $('#feature').cycle({ fx: 'scrollLeft', easing: 'easeOutExpo', speed: 1000, timeout: 3000, be
$('#feature').cycle({
fx: 'scrollLeft',
easing: 'easeOutExpo',
speed: 1000,
timeout: 3000,
before: onBefore
});
function onBefore(curr, next, opts, forwardFlag) {
$(curr).children("div").animate({ left : '960px' }, 300, function() { });
}
似乎无法将幻灯片转换延迟到onBefore完成。作为一种变通方法,我可以通过描述下一张幻灯片在当前幻灯片的下一张幻灯片中转换之前会发生什么来完成以下工作 /*手动描述第一个动画的动画*/
$('#feature .featureStory:first').children("a").delay(4500).animate({marginTop:'100'}, 500);
/*传递循环调用'after'和'skipInitializationCallbacks'*/
$('#feature').cycle({
fx: 'scrollLeft',
easing: "easeOutExpo",
speed: 1000,
timeout: 6000,
after: onAfter,
skipInitializationCallbacks: true
});
/*在当前幻灯片的下一张幻灯片上为下一张幻灯片制作所有动画*/
function onAfter(curr, next, opts, ff) {
$(next).children(".featureStory").animate({left:'560px'}, 500, function(){
$(this).children("a").animate({marginTop:'0'}, 500);
$(this).children("a").delay(3500).animate({marginTop:'100'}, 500);
$(next).children(".featureStory").delay(4500).animate({ left : '960px' }, 500);
});
}
现在,如果没有完整的上下文,我相信这真的很混乱,但它应该让您了解如何在幻灯片转换之前通过使用上一张幻灯片的onAfter和一些延迟来让事情在适当的时间执行,从而使事情具有动画效果