调整大小的事件已停止 [英] Event for resize stopped
本文介绍了调整大小的事件已停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一个事件可以告诉我用户何时通过松开鼠标按钮来停止调整大小?我正在看$(window).resize,它为每个像素移动触发.我只需要知道他们什么时候停止.
Is there an event that tells me when the user has stopped resizing by letting go of the mouse button? I'm looking at $(window).resize, and it's firing for every pixel movement. I just need to know when they've stopped.
推荐答案
否,但是您可以根据需要推迟事件处理程序:
no, but you can defer the event handler if you want:
function onResize(){ ... }
var timer;
$(window).bind('resize', function(){
timer && clearTimeout(timer);
timer = setTimeout(onResize, 100);
});
这将在用户停止调整大小100毫秒后触发.
this will make it fire after the user has stopped resizing for 100ms.
这篇关于调整大小的事件已停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文