使用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');