我刚刚通过更改脚本使其工作了。
$('#thisElement').show();
to
$('#thisElement').css({'display':'block'});
在这个场景中,#thisElement
被加载为 display:none;
这两个表达式有根本性的区别吗?
<span id="thisElement" style="display: none;">Foo</span>
当您调用时:
$('#thisElement').show();
你将获得:
<span id="thisElement" style="">Foo</span>
while:
$('#thisElement').css({'display':'block'});
做什么:
<span id="thisElement" style="display: block;">Foo</span>
从 jQuery show() 文档 中:
这个方法大致相当于调用 .css('display', 'block'),除了显示属性会被恢复为初始值。如果一个元素的显示属性是 inline,则它被隐藏和显示后,将再次以 inline 显示。