解决js window resize为什么会执行两次

//让 onresize 事件只执行一次,默认两次,稍作修改。。。
var resizeTimer = null;


window.onresize = function(){
   resizeTimer = resizeTimer ? null : setTimeout(doResize,0);
}


function doResize(){
   alert('resize');
}
 

转载之http://henry8088.iteye.com/blog/738778

你可能感兴趣的:(window)