ITeye博客

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

javaEEdevelop · 2012-09-14 21:19 · Web前端 · Markdown

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


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


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

 

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。