0
点赞
收藏
分享

微信扫一扫

227-layui table 自适应高度,且横向滚动条固定在底部

        var adjustTableHeight = function (){

            var x1 = top.window.innerHeight
            console.log("x1",x1)
            var x2 = top.layui.$(".layui-header").height();
            console.log("x2",x2)

            var sumRowHeight = 42
            var xScrollHeight = 18;
            var tabHeight = 40;

            var searchHeight = $(".searchCls").height()
            console.log("searchHeight",searchHeight)
            var pageHeight = $(".layui-table-page").height();
            console.log("pageHeight",pageHeight)
            var tableHeight = x1-x2 - searchHeight - pageHeight - xScrollHeight - tabHeight - sumRowHeight;
            console.log("tableHeight",tableHeight)
            $("[lay-id=customerOrdersManageTable]").css("height",tableHeight+"px");
            $(".layui-table-main").css("height",(tableHeight-100)+"px")
            $(".layui-table-fixed-r .layui-table-body").css("height",(tableHeight-117)+"px")
        };
        window.addEventListener('resize', function() {
            adjustTableHeight();
        });
举报

相关推荐

0 条评论