How can I detect window/browser size with jQuery like Gmail? In Gmail, we don\'t need to refresh or reload current page as soon as we have changed window resolution in windo
You make one div somewhere on the page and put this code:
Here is a snippet:
var WindowsSize=function(){
var h=$(window).height(),
w=$(window).width();
$("#winSize").html("Width: "+w+"
Height:"+h+"
");
};
$(document).ready(WindowsSize);
$(window).resize(WindowsSize);
#winSize{
position:fixed;
bottom:1%;
right:1%;
border:rgba(0,0,0,0.8) 3px solid;
background:rgba(0,0,0,0.6);
padding:5px 10px;
color:#fff;
text-shadow:#000 1px 1px 1px,#000 -1px 1px 1px;
z-index:9999
}
Of course, adapt it to fit your needs! ;)