469,573 Members | 1,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

window.onresize slow (firefox)

yb
I am attempting to modify the style of an element (its width) as the
window is being resized, in firefox.

Long story short, I've tried to use CSS but one particular part of the
layout just won't do what I need.

The javascript solution assigns a function to window.onresize that
sets the inline style, it works with one problem -- the handler only
gets called after the resizing stops, and so there is noticeable lag
before it redraws.

It is not the function that is taking a long time to execute, its
appears to be firefox's handling. It doesn't call it as frequently as
I expected.

Is there another javascript method to accomplish this without the
extra lag?

Thank you

Mar 19 '07 #1
2 5022
yb wrote on 19 mrt 2007 in comp.lang.javascript:
I am attempting to modify the style of an element (its width) as the
window is being resized, in firefox.

Long story short, I've tried to use CSS but one particular part of the
layout just won't do what I need.

The javascript solution assigns a function to window.onresize that
sets the inline style, it works with one problem -- the handler only
gets called after the resizing stops, and so there is noticeable lag
before it redraws.

It is not the function that is taking a long time to execute, its
appears to be firefox's handling. It doesn't call it as frequently as
I expected.
why would you want it to be done so frequently?
Is there another javascript method to accomplish this without the
extra lag?
Show your code, only the working relevant part please.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 19 '07 #2
yb wrote :
I am attempting to modify the style of an element (its width) as the
window is being resized, in firefox.

Long story short, I've tried to use CSS but one particular part of the
layout just won't do what I need.

The javascript solution assigns a function to window.onresize that
sets the inline style, it works with one problem -- the handler only
gets called after the resizing stops,
That's by design. IE will fire the onresize event continuously.
Mozilla-based browsers will fire the onresize event once the mouse
cursor stops moving:

Bugzilla 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

and so there is noticeable lag
before it redraws.

It is not the function that is taking a long time to execute, its
appears to be firefox's handling. It doesn't call it as frequently as
I expected.

Is there another javascript method to accomplish this without the
extra lag?

Thank you
First please provide an url so that we can better understand what you
are trying to do and why. Otherwise, explain why the image dimensions
must relate to the size of the window. Second, there may be - I'm sure
- an alternative to what you are trying to do.

E.g.:
Just go to
http://www.gtalbot.org/
and then resize the window in IE7, Firefox 2, Opera 9, Konqueror 3.x,
etc.. The image will be resized accordingly and continuously along with
the browser window viewport: no javascript, no complicated CSS there.

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Mar 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Edwin Boersma | last post: by
2 posts views Thread by David | last post: by
4 posts views Thread by me54 | last post: by
2 posts views Thread by Tony | last post: by
8 posts views Thread by David Gravereaux | last post: by
7 posts views Thread by Dr J R Stockton | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.