Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cancelling the OnResize event
Message
De
18/01/2012 10:32:23
 
 
À
18/01/2012 10:05:20
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01533040
Message ID:
01533203
Vues:
28
>http://www.quirksmode.org/dom/events/resize.html
>states:
>
>
>Amount of events
>=============
>
>But how many events fire, and when? On Windows 7 and Mac 10.6 all browsers fire many events during the resize action, except Opera Mac, which also fires many events, but only when the resize action has ended.
>
>Windows XP
>----------------
>On Windows XP, if you switch “Show window contents while dragging” off, all browsers fire one resize event at the end of the resize (except for IE 5.5 and 6, which fire two).
>  In IE, Safari, and Chrome many resize events fire as long as the user continues resizing the window.
>  Opera uses as many resize events, but fires them all at the end of the resizing.
>  Firefox fires one resize event at the end of the resizing.
>
>
>It looks like you can't count on a pixel-by-pixel resize() firing.
>One way could be to store .minWidth and .maxWidth somewhere in the DOM and test in resize() if dimensions are larger and smaller, then get back to min/max.
>
>should work on end-of-resize firing, maybe not on pixel-by-pixel resize() firing.

I used two approaches yesterday. One was to set up a timer on the resize event. The timer had a one second timeout. If the timer wasn't null, it meant that I was skipping the resize event code. Otherwise, it meant one second has elapsed and I was executing the code.

Another approach was to compare the lcOldData with lcNewData, which was corresponding to the last coordinates of the window before and after. If they were different, it meant at least one pixel had changed.

But, the best would be to benefit from a resize stop event. Because, yesterday, I had the need to store the new width of the window in a user profile. And, I only wanted to do that once the user finishes to resize the window. As, I do not want to update the table at every one pixel change. But, this is no longer needed. But, it was an interesting thread. Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform