Template:Team:Berkeley/windowSize.js
From 2013.igem.org
(Difference between revisions)
Line 8: | 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':'1000px' }); | + | $globalWrapper.css({'width':'1000px' }); |
} | } | ||
else { | else { |
Revision as of 00:24, 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);
});