.fadeOut()方法使用display属性的visibility属性 [英] The .fadeOut() method to use visibility property insted of display property

查看:189
本文介绍了.fadeOut()方法使用display属性的visibility属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.fadeOut()方法动画匹配元素的不透明度。一旦不透明度达到0,显示样式属性设置为none,因此元素不再影响页面的布局,同样是为fadeIn()。

The .fadeOut() method animates the opacity of the matched elements. Once the opacity reaches 0, the display style property is set to none, so the element no longer affects the layout of the page and same is for fadeIn().

我的问题是他们可以使用可见性属性,因此它们的元素占据页面布局的空间,而不只是可见的。

My Question is can they use visibility property so they the element occupy the space in layout of the page and is not just visible?

推荐答案

使用jQuery的 fadeTo(),然后使用回调设置可见性。示例:

Use jQuery's fadeTo() and then have a callback set the visibility. Example:

$('selector').fadeTo(500, 0, function(){
   $('selector').css("visibility", "hidden");   
}); // duration, opacity, callback

http://jsfiddle.net/7HjB6/

这篇关于.fadeOut()方法使用display属性的visibility属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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