【问题标题】:Sticky Table Headers & Columns - Two fixed columns粘性表格标题和列 - 两个固定列
【发布时间】:2015-02-04 18:49:19
【问题描述】:

我在表格中使用插件Sticky Table Headers & Columns。该插件完美运行。我的问题是如何让第二列固定。我搜索了文档并尝试联系作者,但仍然失败。

我也尝试添加另一个<th>Sample #2</th>,但是当您滚动时,列顶部会出现一个白色块,如您所见here

我认为我非常接近解决方案。谁能帮我解决这个问题?

已解决: jsfiddle.net/tyanxbbs/8

【问题讨论】:

    标签: jquery css html-table sticky fixed-header-tables


    【解决方案1】:

    在 jquery.stickyheader.js 中编辑以下行并尝试。

    $stickyInsct.html('<thead><tr><th>'+$t.find('thead th:first-child').html()+'</th></tr></thead>');
    

    $stickyInsct.html('<thead><tr><th>'+$t.find('thead th:first-child').html()+'</th><th>'+$t.find('thead th:eq(1)').html()+'</th></tr></thead>');
    

    也更新以下行。我刚刚从 0 变成了 1。

    $stickyCol.append($col)
                    .find('thead th:gt(1)').remove()
                    .end()
                    .find('tbody td').remove();
    

    【讨论】:

    • 我根据您的建议更新了代码。但是滚动时空白仍然存在。我认为问题与文字大小有关,看看jsfiddle.net/tyanxbbs/7
    • @Brightweb ,我刚刚编辑了我的答案。希望对您有所帮助。
    • 干得好!它就像一个魅力,伙计。结果在这里:jsfiddle.net/tyanxbbs/8。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    相关资源
    最近更新 更多