The .fadeOut() method to use visibility property instead of display property

时光怂恿深爱的人放手 提交于 2019-11-28 09:52:26

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/

Just Overwrite the property in the call back

$('Element').on("click", function() {
    $(this).fadeOut(500, function() {
        $(this).css({"display": "block","visibility": "hidden"});  // <-- Style Overwrite 
    }); 
})​
yuvilio

animate with css opacity seems to achieve a similar effect.

$('#element').animate({opacity: 0}, 1000);

Run the same with opacity: 1 to fade back in.

Credit.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!