第一种:
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};
}
如对本文有疑问, 点击进行留言回复!!
JavaScript 好题汇总分享(持续更新,看到好题就写)
XMLHttpRequest 2级 &&进度事件&&JSONP
使用递归原生实现拷贝&&最简单的方法实现深拷贝
网友评论