window size for PWö
by joquery
HTML
<div id="content"></div>
JavaScript
var wWidth;
var wHeight;
var refreshWindowSizes = function() {
wWidth = $(window).width();
wHeight = $(window).height();
var objCSS = {};
if (wWidth < 600) {
objCSS = {
"background-color" : "red",
"color" : "#333",
"text-shadow" : "0 1px 0 rgba(255,255,255,0.7)"
};
} else {
objCSS = {
"background-color" : "green",
"color" : "#fff",
"text-shadow" : "0 -1px 0 rgba(0,0,0,0.5)"
};
}
$("body").css(objCSS);
};
var printSizes = function(selector) {
$(selector).text(wWidth + " : " + wHeight);
};
$(document).ready(function(){
refreshWindowSizes();
printSizes("#content");
});
$(window).on("resize", function() {
refreshWindowSizes();
printSizes("#content");
});