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

微件:FixTableHeader

来自舰R百科
SegFault留言 | 贡献2016年9月27日 (二) 16:10的版本 (创建页面,内容为“<style> #fixed-table-header { background-color: white; } </style><script> window.onscroll = function() { var tables = document.getElementsByClassName("fix-table-...”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

<style>

  1. fixed-table-header { background-color: white; }

</style><script> window.onscroll = function() {

   var tables = document.getElementsByClassName("fix-table-header");
   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>