window.onresize 触发多次解决方法
最近在做一个界面 由于用到iframe 当主页面onresize的时候需要对子页面的布局重新调整 发现onresize时间会重复调用多次随后发现可以通过setTimeout来延迟调用要执行的方法。
具体使用如下:
varresizeTimer = null;function doResize(){document.frames['contentFrame'].SetGrid();}window.onresize = function(){if(resizeTimer) clearTimeout(resizeTimer);resizeTimer = setTimeout("doResize()",100);}
顺便附上作品留念 哈哈
http://dl.iteye.com/upload/attachment/178392/30f6ad65-e3bd-3e95-a3a5-45dd01a543e3.jpg
页:
[1]