Connecting Tech Pros Worldwide Forums | Help | Site Map

dealing with multiple onresize in IE

Tony
Guest
 
Posts: n/a
#1: Dec 6 '05
I have a script that is called by the window.onresize event. The
problem is that the script is called multiple times when I'm resizing
the window in IE - obviously, because IE continuously fires the
onresize event while it is being resized.

What I'm wondering is - does anyone have any suggestions on making the
script function only once, after the last onresize event, rather than
on every one?

I've done some searching, but I'm not getting much - probably because
I'm having trouble finding a good phrasing for the search.

Any help of suggestions would be appreciated.

Thx!


Jim Ley
Guest
 
Posts: n/a
#2: Dec 6 '05

re: dealing with multiple onresize in IE


On 6 Dec 2005 12:07:06 -0800, "Tony" <tony23@dslextreme.com> wrote:
[color=blue]
>I have a script that is called by the window.onresize event. The
>problem is that the script is called multiple times when I'm resizing
>the window in IE - obviously, because IE continuously fires the
>onresize event while it is being resized.[/color]

This is actually a windows window manager configuration option, and
for me other UA's should follow the convention of the WM, of course
they think they know better how a UI should work than how the user's
configured it...
[color=blue]
>What I'm wondering is - does anyone have any suggestions on making the
>script function only once, after the last onresize event, rather than
>on every one?[/color]


clearTimeout(timer)
timer=setTimeout(dosomething,500);

that will perform the action 500ms after the last firing... adjust as
necessary.

Jim.
Tony
Guest
 
Posts: n/a
#3: Dec 7 '05

re: dealing with multiple onresize in IE


>clearTimeout(timer)[color=blue]
>timer=setTimeout(dosomething,500);
>
>that will perform the action 500ms after the last firing... adjust as
>necessary.[/color]

Ah- I had forgotten about clearTimeout - thanks!

Closed Thread


Similar JavaScript / Ajax / DHTML bytes