Print Width of Window
Print the WIDTH of the browser window as it resizes.
by Nirvanachain
HTML
<div>Print Here: <span id="printHere"></span></div>
<br />
<div id="myBox"> </div>
CSS
#myBox {
width:100px;
height:100px;
background-color:blue;
}
JavaScript
$(window).on("resize", function(event){
document.getElementById('printHere').innerHTML = $(this).width();
var x = $(this).width();
if (x < 350) {
$('#myBox').css({'background-color' : 'red'});
}
else {
$('#myBox').css({'background-color' : 'blue'}) ;
}
});