您的位置:首页 > Web前端 > JQuery

jquery让页面中的模块自适应浏览器高度

2015-08-18 14:31 585 查看
//加载时适应浏览器高度
$(document).ready(function() {
//模块尺寸
$('#div_frame_body').css('height', $(window).height());
$('#div_frame_main').css('height', $(window).height() - 110);
$('#div_frame_left').css('height', $(window).height() - 115);
$('#div_frame_right').css('height', $(window).height() - 110);
$('#div_frame_tree').css('height', $(window).height()-5);
$('#div_frame_list').css('height', $(window).height()-5);
$('#frame_left').css('height', $(window).height() - 115);
$('#frame_right').css('height', $(window).height() - 110);
})
//改变窗体大小时适应浏览器高度
$(window).resize(function() {
//模块尺寸
$('#div_frame_body').css('height', $(window).height());
$('#div_frame_main').css('height', $(window).height() - 110);
$('#div_frame_left').css('height', $(window).height() - 115);
$('#div_frame_right').css('height', $(window).height() - 110);
$('#div_frame_tree').css('height', $(window).height());
$('#div_frame_list').css('height', $(window).height());
$('#frame_left').css('height', $(window).height() - 115);
$('#frame_right').css('height', $(window).height() - 110);
});

$('#div_frame_body').css('height', $(window).height());使用juqery函数获取浏览器窗体的高度,后面减去的是已经占用的具体高度
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: