完成一个动画然后启动另一个动画 [英] Finish one animation then start the other one

查看:108
本文介绍了完成一个动画然后启动另一个动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个div和两个单独的链接触发了幻灯片的幻灯片和幻灯片。

I have two divs and two separate links that triggers slideDown and slideUp for the divs.

当其中一个div滑下而我点击另一个时,我隐藏了第一个div(slidingUp),然后打开另一个div(slidingDown)但是,此时它就像一个div向下滑动,另一个同时向下滑动。

When one of the divs are slided down and I click the other one, I hide the first div (slidingUp) and then open the other div (slidingDown) but, at the moment it's like while one div is sliding down, the other, also in the same time, is sliding up.

有没有办法告诉jQuery等待完成一个div的滑落,然后才开始滑向另一个?

Is there a way that would tell jQuery to wait to finish sliding down of one div and only then start sliding up the other?

推荐答案

$('#Div1').slideDown('fast', function(){
    $('#Div2').slideUp('fast');
});

编辑:您是否检查过手风琴插件(如果那是你想要做的)?

Have you checked out the accordion plugin (if that's what you're trying to do)?

这篇关于完成一个动画然后启动另一个动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆