Skip to content

Instantly share code, notes, and snippets.

@gormus
Created July 22, 2012 05:12
Show Gist options
  • Save gormus/3158517 to your computer and use it in GitHub Desktop.
Save gormus/3158517 to your computer and use it in GitHub Desktop.
Appends an info box to body for displaying the window size. Box content is refreshed by the window resize.
$(document).ready(function () {
$('<div id="WINDOW_SIZE">' + $(window).width() + 'x' + $(window).height() + '</div>')
.attr('unselectable', 'on')
.css({
'position' : 'fixed',
'bottom' : 0,
'right' : 0,
'background' : '#000000',
'color' : '#FFFFFF',
'font' : '16px/1 sans-serif',
'padding' : '10px',
'z-index' : 999999,
'cursor' : 'default',
'-moz-user-select' : 'none',
'-webkit-user-select' : 'none',
'user-select' : 'none',
'-ms-user-select' : 'none'
})
.appendTo('body');
});
$(window).resize(function () {
$("#WINDOW_SIZE").text($(window).width() + 'x' + $(window).height());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment