如何同时运行jQuery fadeIn()和slideDown()? [英] How to run jQuery fadeIn() and slideDown() simultaneously?

查看:68
本文介绍了如何同时运行jQuery fadeIn()和slideDown()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带显示的div:无;
现在我要同时使用它们显示:fadeIn和slideDown。

I've got a div with display: none; Now I want to show it using both: fadeIn and slideDown simultaneously.

$(this).slideDown({duration: 'slow', queue: false});
$(this).fadeIn({duration: 'slow', queue: false});

已正确选择div。但是,当我触发效果时,它所做的就是slideDown。而且,如果我只是删除slideDown,则可以看到fadeIn,因此语法没有任何问题。
但是为什么不同时触发这两个动画?

The div is selected properly. But when I trigger the effect, all it does is the slideDown. And if I just delete the slideDown I can see the fadeIn, so there is nothing wrong with the syntax. But why doesn't it trigger both animations?

推荐答案

使用 animate()而不是 fadeIn()

$(this)
  .css('opacity', 0)
  .slideDown('slow')
  .animate(
    { opacity: 1 },
    { queue: false, duration: 'slow' }
  );

这篇关于如何同时运行jQuery fadeIn()和slideDown()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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