您现在的位置: 万盛学电脑网 >> 程序编程 >> 脚本专题 >> javascript >> 正文

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

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 本篇文章主要是对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};  }