Template:Team:Berkeley/windowSize.js

From 2013.igem.org

(Difference between revisions)
(Created page with " $(document).ready(function() { // Optimalisation: Store the references outside the event handler: var $window = $(window); var $globalWrapper = $('#globalWrapper'); ...")
Line 1: Line 1:
-
 
$(document).ready(function() {
$(document).ready(function() {
     // Optimalisation: Store the references outside the event handler:
     // Optimalisation: Store the references outside the event handler:
Line 9: Line 8:
         if (windowsize < 1000) {
         if (windowsize < 1000) {
             //if the window is greater than 440px wide then turn on jScrollPane..
             //if the window is greater than 440px wide then turn on jScrollPane..
-
             $globalWrapper.css('width':'100px' });
+
             $globalWrapper.css('width':'1000px' });
         }
         }
         else {
         else {

Revision as of 00:23, 25 October 2013

$(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 < 1000) {
           //if the window is greater than 440px wide then turn on jScrollPane..
           $globalWrapper.css('width':'1000px' });
       }
       else {
           $globalWrapper.css({'width':'100%'});        
       }
   }
   // Execute on load
   checkWidth();
   // Bind event listener
   $(window).resize(checkWidth);

});