铬 + jQuery 隐藏/显示内联

发布于 2024-08-27 07:41:44 字数 1035 浏览 7 评论 0原文

我有这些东西

<ul class="ul_std"  style="float:right">
             <li class="action_buttons" ><a id="button_deleteNormal" class="button_small button_small_red"  >Διαγραφή</a></li>
                <li class="action_buttons"><a id="button_editCancel" class="button_small"  >Ακύρωση Τροποποίησης</a></li>
                <li class="action_buttons"><a id="button_editNormal" class="button_small"  >Τροποποίηση</a></li>
                <li class="action_buttons" style="margin-right:0" ><a id="button_addNormal" class="button_small">Προσθήκη</a></li>
              </ul>

问题是我隐藏了所有这些东西,除了 id=button_addNormal 的锚点 在 $(document).ready()... 一切正常,但在 chrome 上,当我想显示它们时,它将它们显示为 display:inline 而不是 display:inline-block ... css类button_small有display:inline-block ....

Firefox,IE 6+工作正常...还没有在safari上测试过,但我希望它会好...

为什么chrome杀死inline-block? 解决方案是放置 .css("display","inline-block") 而不是 .show()

I have these things

<ul class="ul_std"  style="float:right">
             <li class="action_buttons" ><a id="button_deleteNormal" class="button_small button_small_red"  >Διαγραφή</a></li>
                <li class="action_buttons"><a id="button_editCancel" class="button_small"  >Ακύρωση Τροποποίησης</a></li>
                <li class="action_buttons"><a id="button_editNormal" class="button_small"  >Τροποποίηση</a></li>
                <li class="action_buttons" style="margin-right:0" ><a id="button_addNormal" class="button_small">Προσθήκη</a></li>
              </ul>

The problem is that i hide all of them except the anchor with id = button_addNormal
at $(document).ready()...
Everything works fine but at chrome when i want to show them ,it displays them as display:inline and not as display:inline-block ...
The css class button_small have display:inline-block....

Firefox,IE 6+ works ok... Havent tested on safari but i hope that it would be ok...

Why chrome kills inline-block?
The solution was to put .css("display","inline-block") instead of .show()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

还不是爱你 2024-09-03 07:41:44

我用jsp编写了一个网上商店系统,上周捕获了这个错误。我认为这个问题是一个缓存问题,因为代码在Users.jsp中工作,而相同的代码不在Subjects.jsp中工作。这两个代码都可以在 FF、IE、Opera 中运行。有时有效,有时无效。
使用 hide('slow'),它是相同的解决方案......

I write a web store system in jsp, and a catch this error in last week. I think this problem is a caching problem, because a code works in Users.jsp, and same code not in Subjects.jsp. Both code work in FF, IE, Opera. Sometimes it works, sometimes not.
Use hide('slow'), it's same solution...

淡写薰衣草的香 2024-09-03 07:41:44

根据您的问题,我无法在 Chrome 中重现此问题(至少在最新版和 5.0.356.2 beta 版中)。
在 jsFiddle 上查看工作演示

当我使用 $('ul li a:not(#button_addNormal)').hide(); 隐藏除最后一个之外的所有内容并再次显示它们时,它会以 inline- 的形式返回块。我在 jQuery 1.3.21.4.2nightly 中进行了测试,结果相同(也在最新的稳定版 chrome 中进行了测试/工作:4.1.129.1042)。

您的页面中还有其他东西破坏了这一点,如果没有其余代码,很难说是什么。

I can't reproduce this in chrome (at least in latest and 5.0.356.2 beta) based on your question.
See a working demo here on jsFiddle.

When I hide all but the last one with $('ul li a:not(#button_addNormal)').hide(); and show them all again, it comes back as inline-block. I tested in jQuery 1.3.2, 1.4.2, and nightly, same result (also tested/working in latest stable chrome: 4.1.129.1042).

Something else is breaking this in your page, hard to say what without the rest of the code.

夏夜暖风 2024-09-03 07:41:44

使用 $("#something").css("display", "block");而不是展示。 (或内联块)

Use $("#something").css("display", "block"); instead of show. (or inline-block)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文