使用jQuery 1.9显示隐藏的内联块元素 [英] Show hidden inline-block elements with jquery 1.9
本文介绍了使用jQuery 1.9显示隐藏的内联块元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果显示隐藏的块(如果是CSS),则存在问题:inline-block.
I've problem with showing hidden blocks, if they are css: inline-block.
div.profile{
display: inline-block;
}
<div class='profile' style='display: none;'>profile info</div>
但是当我执行$('.profile').show()时,它变为style ='display:block'(我可以在萤火虫中看到它)并覆盖我的CSS样式...
But when i do $('.profile').show() it becomes style='display: block' (i can see it in firebug) and overrites my css style...
我该如何解决?
顺便说一句,在jquery 1.4中它可以正常工作.
btw, in jquery 1.4 it works correctly.
谢谢.
UPD
$.css('display','inline-block'),imo,不是通用解决方案.
$.css('display', 'inline-block'), imo, is not universal solution.
推荐答案
您应该更改css样式,而不要使用show
函数,该样式将其更改为block
.
You should change the css style instead of using the show
function, which changes it to block
.
$('.profile').css('display', 'inline-block');
这篇关于使用jQuery 1.9显示隐藏的内联块元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文