jQuery fadeIn()上显示none [英] jQuery fadeIn() on display none

查看:111
本文介绍了jQuery fadeIn()上显示none的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div,我做了一个 $('#div')。css('display','none');



现在,为了使这个项目回来,我想淡入它。但是,它似乎像 $('#div')。fadeIn()没有这样做,但我不想将显示设置回阻止,就好像我这样做只是立即重新出现而不是褪色..任何想法?

解决方案

尝试

  $('#div')。hide(); 

可以隐藏元素。

更新:我提出这个问题是因为我在上设置了 .css('display','none') body 在Firefox中。但它应该适用于其他元素。



但是,如果它不适用于 hide()那么您肯定有另一个问题,你必须发布更多的代码或提供演示。



在哪个浏览器中失败?你确定 $('#div')。fadeIn()是否被执行?


I have a div where I did a $('#div').css('display', 'none');

Now, to bring this item back, I want to fade it in. However, it seems like $('#div').fadeIn() is not doing it, but I don't want to set display back to block, as if I do it just re-appears instantly instead of fading.. any ideas?

解决方案

Try

$('#div').hide();

to hide the element.

Update: I suggested this because I came a problem with setting .css('display', 'none') on the body in Firefox. But it should work for other elements.

But if it does not work with hide() then you definitely have another problem and you have to post more code or provide a demo.

In which browser does it fail? Are you sure $('#div').fadeIn() is executed?

这篇关于jQuery fadeIn()上显示none的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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