0

I have a fiddle here:

http://jsfiddle.net/fJMe9/

window.onresize = function (e) {
    console.log("Page resized");
};

And every time I resize the window I get two logs to the console

Hoa
  • 19,858
  • 28
  • 78
  • 107

2 Answers2

3

It's a well known bug (perhaps relating to event bubbling? I say well known, but that's other people who know it, not me :P ). Use a setTimeout to check the last time the window was resized to avoid this.

Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123
0

Try:

window.onresize = function (e) {
    console.log(e);
};

you'll see the event fires every time you drag the browser window

Depends on implementation: maybe 2 times, the first for tell you the window is being resized and the second for windows finished resizing.

VMOrtega
  • 1,948
  • 3
  • 18
  • 22