淘先锋技术网

首页 1 2 3 4 5 6 7

表格table水平自适应,可以设置宽度100%
表格table垂直自适应,需要设置表格的高度,根据高度,表格的垂直滚动条会自动的显示和隐藏
垂直滚动条,需要设置指定的高度,当table的高度超过这个高度时,就会出现垂直滚动条
页面的元素都是分块的,tab、search、title、button、table等模块,页面和页面上的元素也是不一样的,需要jQuery获取高度

// 页面初始化
$(function () {
    var webHeight = window.innerHeight;
    var tabHeight = $('.tabStyle').innerHeight();
    var searchHeight = $('.searchStyle').innerHeight();
    var titleHeight = $('.toolTitleStyle').innerHeight();
    var toolHeight = $('.toolStyle').innerHeight();
    var pageHeight = $('.pagefooterStyle').innerHeight();
    if (tabHeight == null) {
        tabHeight = ;
    }
    if (searchHeight == null) {
        searchHeight = ;
    }
    if (titleHeight == null) {
        titleHeight = ;
    }
    if (toolHeight == null) {
        toolHeight = ;
    }
    if (pageHeight == null) {
        pageHeight = ;
    }
    var height = webHeight - tabHeight - searchHeight - titleHeight - toolHeight - pageHeight - ;
    var table = $('.listTableStyle');
    if (table != null) {
        $('.listTableStyle').css("height", height);
    }
});

// 浏览器改变大小
$(window).resize(function () {
    var webHeight = window.innerHeight;
    var tabHeight = $('.tabStyle').innerHeight();
    var searchHeight = $('.searchStyle').innerHeight();
    var titleHeight = $('.toolTitleStyle').innerHeight();
    var toolHeight = $('.toolStyle').innerHeight();
    var pageHeight = $('.pagefooterStyle').innerHeight();
    if (tabHeight == null) {
        tabHeight = ;
    }
    if (searchHeight == null) {
        searchHeight = ;
    }
    if (titleHeight == null) {
        titleHeight = ;
    }
    if (toolHeight == null) {
        toolHeight = ;
    }
    if (pageHeight == null) {
        pageHeight = ;
    }
    var height = webHeight - tabHeight - searchHeight - titleHeight - toolHeight - pageHeight - ;
    var table = $('.listTableStyle');
    if (table != null) {
        $('.listTableStyle').css("height", height);
    }
});