打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

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

微件:FixTableHeader:修订间差异

来自舰R百科
无编辑摘要
无编辑摘要
第2行: 第2行:
window.onscroll = function() {
window.onscroll = function() {
     var tables = document.getElementsByClassName("fix-table-header");
     var tables = document.getElementsByClassName("fix-table-header");
     var hdr = document.getElementById('fixed-table-header');
     var clone = document.getElementById('fixed-table-header');
     for (var i = 0; i < tables.length; ++i) {
     for (var i = 0; i < tables.length; ++i) {
         var table = tables[i];
         var table = tables[i];
         var rect = table.getBoundingClientRect();
         var rect = table.getBoundingClientRect();
         if (rect.top < 0 && rect.bottom > 0) {
         if (rect.top < 0 && rect.bottom > 0) {
             if (hdr == null) {
             if (clone == null) {
                 hdr = table.cloneNode(true);
                 clone = table.cloneNode(true);
                 hdr.id = 'fixed-table-header';
                 clone.id = 'fixed-table-header';
                 hdr.style.position = 'fixed';
                 clone.style.position = 'fixed';
                 hdr.style.pointerEvents = 'none';
                 clone.style.pointerEvents = 'none';
                 hdr.style.top = 0;
                 clone.style.top = 0;
                 hdr.style.width = table.style.width;
                 clone.style.width = table.style.width;
                 table.parentNode.appendChild(hdr);
                 table.parentNode.appendChild(clone);
                 hdr.style.visibility = 'hidden';
                 clone.style.visibility = 'hidden';
                 for (var i = 0; i < hdr.childNodes.length; i++)
                 for (var i = 0; i < clone.childNodes.length; i++) {
                     if (hdr.childNodes[i].tagName == 'THEAD') {
                     var hdr = clone.childNodes[i];
                         hdr.childNodes[i].style.visibility = 'visible';
                    if (hdr.tagName == 'THEAD') {
                         hdr.childNodes[i].style.pointerEvents = 'auto';
                         hdr.style.visibility = 'visible';
                         hdr.style.pointerEvents = 'auto';
                        hdr.style.backgroundColor = table.childNodes[i].style.backgroundColor;
                        console.log(hdr.style.backgroundColor);
                     }
                     }
                }
             }
             }
             return;
             return;
         }
         }
     }
     }
     if (hdr != null) hdr.remove();
     if (clone != null) clone.remove();
}
}
</script><style> #fixed-table-header { background-color: white; } </style></includeonly>
</script><style> #fixed-table-header { background-color: white; } </style></includeonly>