.fadeOut()方法使用可见性属性代替显示属性 [英] The .fadeOut() method to use visibility property instead of display property

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

问题描述

.fadeOut()方法可对匹配元素的不透明度进行动画处理.一旦不透明度达到0,display style属性将设置为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()方法使用可见性属性代替显示属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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