Template:Team:Berkeley/windowSize.js

From 2013.igem.org

$(document).ready(function() {

   // Optimalisation: Store the references outside the event handler:
   var $window = $(window);
   var $globalWrapper = $('#globalWrapper');
   function checkWidth() {
       var windowsize = $window.width();
       if (windowsize < 1110) {
           //if the window is greater than 440px wide then turn on jScrollPane..
           $globalWrapper.css({'width':'1110px' });
       }
       else {
           $globalWrapper.css({'width':'100%'});        
       }
   }
   // Execute on load
   checkWidth();
   // Bind event listener
   $(window).resize(checkWidth);

});