Praveen Prasad
Praveen Prasad

Reputation: 32137

Initiating a function after window resizing finishes

I want to initiate a function when user finishes resizing of his browser window. Please suggest how to do it in either pure JS or jQuery.

Note: I want to raise the event only once and after user has done browser resizing.

Upvotes: 0

Views: 128

Answers (3)

Chetan S
Chetan S

Reputation: 23823

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

Upvotes: 1

RKitson
RKitson

Reputation: 2013

From the docs:

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

Upvotes: 0

zincorp
zincorp

Reputation: 3282

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

Upvotes: 0

Related Questions