jquery讓頁面中的模塊自適應瀏覽器高度


//加載時適應瀏覽器高度
$(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函數獲取瀏覽器窗體的高度,后面減去的是已經占用的具體高度


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM