I use custom resizing events (tested in IE6-8, Opera 10, FF 3.6):

/**
 * Window resizing events: resize:start, resize:continued, resize:end.
 *
 * Event resize:continued will fire with interval >= delayRC milliseconds 
and
 * only if window size is actually changed (e.g. no repeated events with 
same window size).
 *
 * Event resize:end will fire if window dimensions stay unchanged for 
delayRE milliseconds.
 *
 * Each event will supply actual window dimensions as additional parameter.
 */
(function() {
  var timerRC = null, timerRE = null, delayRC = 200, delayRE = 500, 
dimensions = {};
    
  function fireResizeContinued() {
    var dims = document.viewport.getDimensions();
    if (dims.width !== dimensions.width || dims.height !== 
dimensions.height) {
      dimensions = dims;
      document.fire("resize:continued", dimensions);
    }
    timerRC = setTimeout(fireResizeContinued, delayRC);
  }

  function fireResizeEnd() {
    clearTimeout(timerRC);
    timerRC = null;
    timerRE = null;
    document.viewport.isResizing = false;
    document.fire("resize:end", document.viewport.getDimensions());
  }

  function resizeListener() {
    //console.log("resizeListener - isResizing", 
document.viewport.isResizing);
    if (!document.viewport.isResizing) {
      dimensions = document.viewport.getDimensions();
      document.viewport.isResizing = true;
      document.fire("resize:start", dimensions);
      timerRC = setTimeout(fireResizeContinued, delayRC);
    }
    if (timerRE) {
      //console.log("clearTimeout(timerRE)");
      clearTimeout(timerRE);
    }
    timerRE = setTimeout(fireResizeEnd, delayRE);
  }

  Event.observe((document.onresize ? document : window), "resize", 
resizeListener);
})();


You can listen to resize:continued and resize:end and change your size 
accordingly to dimensions received in event's memo field.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/B8hqlNqoRiIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to