舰R百科是靠无数自愿编辑者持续地建设更新完善的。编辑非常简单,无需代码知识,请勇于更新页面!
编辑入门 | 资助百科 | 留言讨论页 | 微博@舰R百科 | 百科编辑讨论Q群:366818861

微件:Sandbox:修订间差异

来自舰R百科
跳转到导航 跳转到搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
<includeonly><p>payload</p>
<includeonly><script>
window.onscroll = function() {
    var tables = document.getElementsByClassName("fixed-header-table");
    var hdr = document.getElementById('fixed-table-header');
    for (var i = 0; i < tables.length; ++i) {
        var table = tables[i];
        var rect = table.getBoundingClientRect();
        if (rect.top < 0 && rect.bottom > 0) {
            if (hdr == null) {
                hdr = table.cloneNode(true);
                hdr.id = 'fixed-table-header';
                hdr.style.position = 'fixed';
                hdr.style.pointerEvents = 'none';
                hdr.style.top = 0;
                hdr.style.width = table.style.width;
                table.parentNode.appendChild(hdr);
                hdr.style.visibility = 'hidden';
                for (var i = 0; i < hdr.childNodes.length; i++)
                    if (hdr.childNodes[i].tagName == 'THEAD') {
                        hdr.childNodes[i].style.visibility = 'visible';
                        hdr.childNodes[i].style.pointerEvents = 'auto';
                    }
            }
            return;
        }
    }
    if (hdr != null) hdr.remove();
}
</script><p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<div id="fixed-header-table-container">
<table class="fixed-header-table">
<table id="fixed-header-table">
     <thead> <tr> <th>Col1</th> <th>Col2</th> <th>Col3</th> </tr> </thead>
     <thead> <tr> <th>Col1</th> <th>Col2</th> <th>Col3</th> </tr> </thead>
     <tbody>
     <tbody>
第15行: 第42行:
     </tbody>
     </tbody>
</table>
</table>
<div id="fixed-header-table-bottom"></div>
</div>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<table class="fixed-header-table">
    <thead> <tr> <th>Col1</th> <th>Col2</th> <th>Col3</th> </tr> </thead>
    <tbody>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>some really long line</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
        <tr> <td>info</td> <td>info</td> <td>info</td> </tr>
    </tbody>
</table>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<p>payload</p>
<script>
</includeonly>
window.onscroll = function() {
    var table = document.getElementById("fixed-header-table");
    var hdr = document.getElementById('fixed-table-header');
    var rect = table.getBoundingClientRect();
    if (rect.top < 0 && rect.bottom > 0) {
        if (hdr == null) {
            hdr = table.cloneNode(true);
            hdr.id = 'fixed-table-header';
            hdr.style.position = 'fixed';
            hdr.style.pointerEvents = 'none';
            hdr.style.top = 0;
            hdr.style.width = table.style.width;
            document.getElementById("fixed-header-table-container").appendChild(hdr);
            hdr.style.visibility = 'hidden';
            for (var i = 0; i < hdr.childNodes.length; i++)
                if (hdr.childNodes[i].tagName == 'THEAD') {
                    hdr.childNodes[i].style.visibility = 'visible';
                    hdr.childNodes[i].style.pointerEvents = 'auto';
                }
        }
    } else if (hdr != null) hdr.remove();
}
</script></includeonly>

2016年9月27日 (二) 16:05的版本