小编hbo*_*man的帖子

使用jQuery从表条带中排除嵌套表

我试图从表格条带中排除嵌套表格(使每隔一行具有不同的bg颜色).这是条形表的代码:

$(".stripeTable tbody tr:odd").addClass("stripe");
Run Code Online (Sandbox Code Playgroud)

我的问题是,如何防止嵌套表的奇数行接收类"条带"?

这是从浏览器生成的代码,我想从嵌套表中删除class ="stripe".

   <table>
      <tr>
        <td>My Table Cell </td>
      </tr>
      <tr class="stripe">
        <td>
          <table>
            <tr>
              <td>My nested table cell</td>
            </tr>
            <tr class="stripe">
              <td>my nested table cell (remove the stripe!)</td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
Run Code Online (Sandbox Code Playgroud)

jquery html-table jquery-selectors

3
推荐指数
1
解决办法
1386
查看次数

使用jquery获取多个div的高度

我需要获得三个div的高度,将它们加在一起,看看滚动位置是否大于该数字.现在我能够获得一个元素的高度,但我怎么能添加其他元素呢?

基本上,我想写"如果scroll_top大于div 1 + div 2 + 3的高度"

var scroll_top = $(window).scrollTop();

if ((scroll_top > $('.nav-bar-fixed').height()) {
    alert('sometext');
}
Run Code Online (Sandbox Code Playgroud)

jquery jquery-selectors

1
推荐指数
1
解决办法
8050
查看次数

标签 统计

jquery ×2

jquery-selectors ×2

html-table ×1