jqGrid随窗口大小变化自适应大小的示例代码
第一种:
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};
}
下一篇: 网站推广的常用的方法
推荐阅读