zoukankan      html  css  js  c++  java
  • 滚动条超出表格标题,表格标题固定

    css:样式

    #divTitle{padding:10px;position:relative;top:0px;93.5%; z-index:100; background-color:#6FA1D8;}

    <div id="divTitle" style=" display:none;">
    <table style=" 100%; border-collapse: collapse;">
    <tr style="background-color: #6fa1d8; height: 24px;">
    <td style="130px;">功能分类名称</td>
    <td style="160px;">项目名称</td>
    <td style="130px;">初始金额</td>
    <td style="130px;">待审核金额</td>
    <td style="90px;">可用金额</td>
    <td style="90px;">实际发生金额</td>
    <td style="90px;">使用百分比列</td>
    </tr>
    </table>
    </div>

    js 脚本

    function menuFixed(id) {
    var obj = document.getElementById(id);
    var _getHeight = obj.offsetTop;
    window.onscroll = function() {
    changePos(id, _getHeight);
    }
    }
    function changePos(id, height) {
    var obj = document.getElementById(id);
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    var height = $("#table_Collgrid").offset().top;
    if (scrollTop+20 < height) {
    obj.style.position = 'relative';
    obj.style.display = "none";
    } else {
    obj.style.position = 'fixed';
    obj.style.display = "";
    }
    }
    window.onload = function() {
    menuFixed('divTitle');
    }

  • 相关阅读:
    Bash 小问题【待更新】
    进程动态优先级调度
    密码
    [Noi2016]优秀的拆分
    [Tjoi2016&Heoi2016]字符串
    [BZOJ 1901]Dynamic Rankings
    [HDU 2665]Kth number
    [BZOJ 4310]跳蚤
    [Sdoi2008]Sandy的卡片
    [Usaco2007 Dec]队列变换
  • 原文地址:https://www.cnblogs.com/linsu/p/5227190.html
Copyright © 2011-2022 走看看