Why onResize fires 3 times when I re-size the window?

J

Jim Ley

Why onResize fires 3 times when I re-size the window?

because it fires as you're resizing it, and not just at the end of the
resize, why would you expect it to only fire at the end?

Jim.
 
G

Gérard Talbot

Jim Ley wrote :
because it fires as you're resizing it, and not just at the end of the
resize, why would you expect it to only fire at the end?

Jim.


IE 6+ will fire the resize event continuously. Opera 8+ also.

Firefox, Mozilla Seamonkey, Mozilla Suite will not.

Bug 114649: onresize events should fire while resizing the window, not
just when the mouse stops moving
https://bugzilla.mozilla.org/show_bug.cgi?id=114649

Gérard
 
G

Gérard Talbot

Jim Ley wrote :
because it fires as you're resizing it, and not just at the end of the
resize, why would you expect it to only fire at the end?

Jim.


IE 6+ will fire the resize event continuously. Opera 8+ also.

Firefox, Mozilla Seamonkey, Mozilla Suite will not.

Bug 114649: onresize events should fire while resizing the window, not
just when the mouse stops moving
https://bugzilla.mozilla.org/show_bug.cgi?id=114649

Gérard
 
J

Jim Ley

Jim Ley wrote :


IE 6+ will fire the resize event continuously. Opera 8+ also.

On windows both of these depend on the OS setting show window contents
whilst dragging.

Jim.
 
E

Evertjan.

df wrote on 18 mei 2006 in comp.lang.javascript:
Not understand very much.Would you mind telling more details?

Would you mind where you are talking about?

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers.
<http://www.safalra.com/special/googlegroupsreply/>
 
D

df

Evertjan. 写é“:
df wrote on 18 mei 2006 in comp.lang.javascript:
Would you mind where you are talking about?
Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers.

Roger~
And now,Am I OK this time?
 
D

df

Well,dear guys,I just want append a function to run only *one* time
after the OnResize event is finished.How can I?

Jim Ley 写é“:
 
J

Jim Ley

Well,dear guys,I just want append a function to run only *one* time
after the OnResize event is finished.How can I?


var globalWindowResizeTimer=0

window.onresize=function() {
clearTimeout(globalWindowResizeTimer);
globalWindowResizeTimer=setTimeout(whateverYouWant,150);
}

The normal event culling method.

Jim.
 
T

Thomas 'PointedEars' Lahn

Jim said:
var globalWindowResizeTimer=0

Initializing a timer variable with 0 is by no means a way ...
window.onresize=function() {
clearTimeout(globalWindowResizeTimer);

.... to prevent this from failing or producing undesired side effects.
Instead, the variable should be initialized with a value that is
unlikely to be returned by window.setTimeout(), such as `null', and
_window_.clearTimeout() should only be called iff

1. window.clearTimeout() is available as a method. It appears
safe to assume that if window.setTimeout() is supported,
window.clearTimeout() is supported as well.

2. The argument value is different from the initial value.
globalWindowResizeTimer=setTimeout(whateverYouWant,150);

_window_.setTimeout() should only be called iff that method is supported.
}

The normal event culling method.

For suitable values of "normal".


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top