1、窗口自适应调整 (设置layout的fit属性值为true即可)

//窗口自适应调整      
$(function() {  
    windowResize();  //文档载入时加载  
    $(window).resize(function() {  
        windowResize();  //窗口改变大小时加载  
    });  
});  
  
function windowResize() {  
    var width = $(window).width()-10;   //减去10与body中margin:5px共同作用:为body留的边距  
    var height = $(window).height()-10;  
//  $('form#form1').width(width);  
//  $('form#form1').height(height);  
//  $('form#form1').layout();  //相当于<form id='form1' class='easyui-layout' data-options = "fit:true" runat="server">  
      
      
    $('#autoFitWindow').width(width);  
    $('#autoFitWindow').height(height);  
    $('#autoFitWindow').layout();  //为div设置
}  
View Code

相关文章: