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

微件:Sandbox:修订间差异

来自舰R百科
跳转到导航 跳转到搜索
无编辑摘要
无编辑摘要
第23行: 第23行:
<p>payload</p>
<p>payload</p>
<script>
<script>
function moveScroll(){
window.onscroll = function() {
     var scroll = $(window).scrollTop();
     var pos = window.scrollY;
     var anchor_top = $("#maintable").offset().top;
     var top = document.getElementById("maintable").offsetTop;
     var anchor_bottom = $("#bottom_anchor").offset().top;
     var bottom = document.getElementById("bottom_anchor").offsetTop;
     if (scroll>anchor_top && scroll<anchor_bottom) {
    var hdr = document.getElementById('fixed-table-header');
      clone_table = $("#clone");
     if (top < pos && pos < bottom) {
      if(clone_table.length == 0){
        if (hdr == null) {
        clone_table = $("#maintable").clone();
            table = document.getElementById('maintable');
        clone_table.attr('id', 'clone');
            hdr = table.cloneNode(true);
        clone_table.css({position:'fixed', 'pointer-events': 'none', top:0});
            hdr.id = 'fixed-table-header';
        clone_table.width($("#maintable").width());
            hdr.style.position = 'fixed';
        $("#table-container").append(clone_table);
            hdr.style.pointerEvents = 'none';
        $("#clone").css({visibility:'hidden'});
            hdr.style.top = 0;
        $("#clone thead").css({visibility:'visible', 'pointer-events':'auto'});
            hdr.style.width = table.style.width;
      }
            document.getElementById("table-container").appendChild(hdr);
     } else {
            hdr.style.visibility = 'hidden';
      $("#clone").remove();
            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();
}
}
$(window).scroll(moveScroll);
</script></includeonly>
</script></includeonly>

2016年9月27日 (二) 15:38的版本