您好,欢迎访问一九零五行业门户网

jqGrid随窗口大小变化自适应大小的示例代码_jquery

第一种:
jqgrid随窗口大小变化自适应宽度
复制代码 代码如下:
$(function(){
            $(window).resize(function(){  
         $(#listid).setgridwidth($(window).width());
        });
       });
第二种:
复制代码 代码如下:
window.onresize = function  _doresize() {
 var ss = pagesize();
 $(#listid).jqgrid('setgridwidth', ss.winw-10).jqgrid('setgridheight', ss.winh-200);
   }
function pagesize() {
   var winw, winh;
  if(window.innerheight) {// all except ie
   winw = window.innerwidth;
   winh = window.innerheight;
  } else if (document.documentelement && document.documentelement.clientheight) {// ie 6 strict mode
   winw = document.documentelement.clientwidth;
   winh = document.documentelement.clientheight;
  } else if (document.body) { // other
   winw = document.body.clientwidth;
   winh = document.body.clientheight;
  }  // for small pages with total size less then the viewport
  return {winw:winw, winh:winh};
}
其它类似信息

推荐信息