Skip to content

Instantly share code, notes, and snippets.

@tlinkner
Last active October 12, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlinkner/28bbbaa3fcd7439ede5d to your computer and use it in GitHub Desktop.
Save tlinkner/28bbbaa3fcd7439ede5d to your computer and use it in GitHub Desktop.
Show browser dimensions
/* Debug: Tell Size
===========================================================
Show browser size. Turn off on production.
*/
(function () {
var ts = document.createElement('div');
ts.setAttribute("id", "msg");
ts.style.cssText = "padding:0.25em;position:fixed;bottom:0;right:0;font-size:0.75em;font-weight:bold;color:white;background:red;";
document.body.appendChild(ts);
function tellSize() {
ts.innerHTML = window.innerWidth + "px x " + window.innerHeight + "px";
}
window.onload = tellSize;
window.onresize = tellSize;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment