Team:UNITN-Trento/JS/Library/onWidthChange

From 2013.igem.org

Revision as of 16:19, 8 August 2013 by Ggirelli (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/**

* onWidthChange (oWri) event handler
* @version onWidthChange 1.0
* @copyright Copyright (c) 2010-2012, Gabriele Girelli
* @author ggirelli <g.girelli@studenti.unitn.it>
*/

function oWch(event) {

   var getWidthValue = function() {
       return window.innerWidth;
   }
       var lastWidth = getWidthValue();
   (function listenWidth() {
       var width = getWidthValue();
       if (width !== lastWidth) {
           event();
           lastWidth = width;
       }
       var w = setTimeout(listenWidth, 100);
   })();

}