Hide element but maintain the space
This question already has an answer here:
If you want the same effect as visiblity: hidden
, then use that.
$('some selector').css('visibility', 'hidden');
Or set the opacity to zero, if you're looking for something that you can animate:
$('some selector').animate({'opacity': 0}, 1000);
I think that it is important to understand that JQuery is nothing more than a Javascript library, so if you know a way to do something with pure JS, then just do it. You don't have to rely on JQuery to do it. Both JS and JQuery have a way to get a DOM element and change its style attributes. Since Matt provided a JQuery answer, here is how it is done with pure Javascipt:
document.getElemenyById("id").style.visibility = "hidden";
链接地址: http://www.djcxy.com/p/83554.html
上一篇: .show()和.hide()如何在jquery中工作
下一篇: 隐藏元素但保持空间