viewportsizemonitor.js
No description.

File Location

/goog/dom/viewportsizemonitor.js

Classes

goog.dom.ViewportSizeMonitor
This class can be used to monitor changes in the viewport size. Instances dispatch a goog.events.EventType.RESIZE event when the viewport size changes. Handlers can call goog.dom.ViewportSizeMonitor#getSize to get the new viewport size. Use this class if you want to execute resize/reflow logic each time the user resizes the browser window. This class is guaranteed to only dispatch RESIZE events when the pixel dimensions of the viewport change. (Internet Explorer fires resize events if any element on the page is resized, even if the viewport dimensions are unchanged, which can lead to infinite resize loops.) Example usage:
   var vsm = new goog.dom.ViewportSizeMonitor();
   goog.events.listen(vsm, goog.events.EventType.RESIZE, function(e) {
     alert('Viewport size changed to ' + vsm.getSize());
   });
 
Manually verified on IE6, IE7, FF2, Opera 11, Safari 4 and Chrome.

Public Protected Private

Global Functions

goog.dom.ViewportSizeMonitor.getInstanceForWindow(opt_window) !goog.dom.ViewportSizeMonitor
Returns a viewport size monitor for the given window. A new one is created if it doesn't exist already. This prevents the unnecessary creation of multiple spooling monitors for a window.
Arguments:
opt_window : Window=
The window to monitor; defaults to the window in which this code is executing.
Returns: !goog.dom.ViewportSizeMonitor  Monitor for the given window.
code »
goog.dom.ViewportSizeMonitor.removeInstanceForWindow(opt_window)
Removes and disposes a viewport size monitor for the given window if one exists.
Arguments:
opt_window : Window=
The window whose monitor should be removed; defaults to the window in which this code is executing.
code »

Directory dom

File Reference