【问题标题】:jQuery nth-child not working in IE7jQuery nth-child 在 IE7 中不起作用
【发布时间】:2023-03-09 23:11:01
【问题描述】:

我正在尝试使用 jQuery 在父级中的每 3 个 section 元素上添加边距:

$(function(){
    $('.portfolio-box:nth-child(3n)').css("margin", "0px 0 30px 0");
});

这是我的 HTML:

<section class="portfolio-contents">
<section class="portfolio-box"></section>
<section class="portfolio-box"></section>
<section class="portfolio-box"></section>
</section>

这一切都适用于所有浏览器,包括 IE8 及更高版本,但它不适用于 IE7,请帮助。

这适用于除 Internet Explorer 7 之外的所有浏览器。有人知道为什么/如何修复它吗?

【问题讨论】:

  • 你是如何测试的? IETest 有机会吗?
  • 请描述“不工作”。当你试图解释一个问题时,“不工作”是远远不够的。

标签: jquery internet-explorer-7 css-selectors


【解决方案1】:

您使用的是html5 shim 吗?最坏的情况,使用 div 而不是部分。他们似乎在 ie7 下工作:http://jsfiddle.net/Dsmns/

【讨论】:

    猜你喜欢
    • 2013-05-28
    • 1970-01-01
    • 1970-01-01
    • 2014-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-10
    • 2012-06-11
    相关资源
    最近更新 更多