topical media & game development

talk show tell print

#javascript-code-14-resize.js / js



  // Watch for the user resizing the browser window
  window.onresize = function() {
      // Locate the document element (to be used to find the window width)
      var de = document.documentElement;
  
      // Figure out the width of the browser
      // (unfortunately, every browser likes to do this differently)
      var w = window.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
  
      // If the window is too small, add a class to document element
      de.className = w < 990 ? "small" : "";
  };
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.