Skip to content

Instantly share code, notes, and snippets.

@tlinkner
Created October 26, 2017 17:07
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/058f31484ed817a3fe739f76b7d2955a to your computer and use it in GitHub Desktop.
Save tlinkner/058f31484ed817a3fe739f76b7d2955a to your computer and use it in GitHub Desktop.
/* 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"
+ "<br>" + (window.innerWidth/16) + "em x " + (window.innerHeight/16) + "em";
}
window.onload = tellSize;
window.onresize = tellSize;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment