开发者

initiating a function after window resizsing finishes

i want to initiate a function when user finishes resizing of his browser window. please suggest how to do in either pure JS or jquery.

Note: i want to raise the开发者_如何转开发 event only once and after user has done browser resizing.


You can introduce a small delay before running the resize handler using setTimeout and keep renewing this timeout until the events stop. This article explains how to do it - http://ajaxian.com/archives/delaying-javascript-execution


window.onresize = function() { alert('hi'); };


From the docs:

$(window).resize(function() {
   $('#log').append('<div>Handler for .resize() called.</div>');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜