并行 jQuery 效果
我想并行执行两个效果。 jQuery UI“转移”动画和另一个元素上的“淡入”动画。它们应该同时开始和结束。
到目前为止我的代码:
$('#foo').hover(function() {
$(this).effect("transfer", {
to: "#transition-target",
className: "ui-effects-transfer"
}, 300, function() {
$('#bar').fadeIn(300);
});
});
我知道这两种效果都是依次执行的。是否可以实现并行效果执行?
I want to execute two effects in parallel. A jQuery UI "transfer" animation and a "fadeIn" on another element. They should begin and end at the same time.
My code so far:
$('#foo').hover(function() {
$(this).effect("transfer", {
to: "#transition-target",
className: "ui-effects-transfer"
}, 300, function() {
$('#bar').fadeIn(300);
});
});
I understand that both effects are executed one after another. Is it possible to achieve parallel effect execution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您在效果的“回调”中具有 fadeIn 函数。仅在动画完成后才会触发/运行回调。这应该可以帮助你..
You had the fadeIn function in the "callback" of the effect. The callback is triggered/run only after the animation has finished. This should help you out..
您可以使用 animate 执行 2 个或更多并行效果。
You can do 2 or more parallel fx using animate.
两个并行运行两个动画,即同时使用
queue : false
并且不要将第二个动画放入第一个动画的回调函数中,如下所示:Two run the two animations in parallel i.e. simultaneously use
queue : false
and don't put the second animation in the callback function of the first one like this: