Skip to content

Instantly share code, notes, and snippets.

@Homlean
Created December 19, 2012 07:33
Show Gist options
  • Save Homlean/4335074 to your computer and use it in GitHub Desktop.
Save Homlean/4335074 to your computer and use it in GitHub Desktop.
延迟resize
// 绑定 resize 重新定位事件
var timeout;
Overlay.allOverlays = [];
$(window).resize(function() {
timeout && clearTimeout(timeout);
timeout = setTimeout(function() {
$(Overlay.allOverlays).each(function(i, item) {
// 当元素隐藏时,不处理
if(!item.get('visible')) {
return;
}
item._setPosition();
});
}, 80);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment