[英]Exit a resize event
I'm having issues exiting a resize event. 我在退出调整大小事件时遇到问题。 I have some operations i want to do whenever the browser window is being resized.
每当调整浏览器窗口大小时,我都想执行一些操作。 However after the resizing event has finished i have some further code that i wan't to be executed.
但是,在调整大小事件完成后,我还有一些其他代码无法执行。 Due to the resizing event not finishing the code that exceeds this event are not being executed.
由于调整大小事件未完成,超出此事件的代码无法执行。
Is there a way to finalize the event or should the resizing event be implemented in another way? 有没有完成事件的方法,或者应该以其他方式实现调整大小的事件? How do i get doMoreStuff() to be executed after the resizing?
调整大小后如何执行doMoreStuff()?
Code example: 代码示例:
$(window).resize(function (){
doStuff();
});
doMoreStuff();
You can do it in two ways. 您可以通过两种方式来实现。
$(window).resize(function() {
doStuff();
doMoreStuff();
});
$(window).resize(function() {
doStuff();
settimeout(function() {
doMoreStuff();
}, 0);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.