Skip to content

Instantly share code, notes, and snippets.

@joebillings
Created January 10, 2015 13:23
Show Gist options
  • Save joebillings/475dd0c175e760bd4128 to your computer and use it in GitHub Desktop.
Save joebillings/475dd0c175e760bd4128 to your computer and use it in GitHub Desktop.
javascript:(function() {
var d = document,
w = window,
sw = function() { return Math.max(d.documentElement.clientWidth, w.innerWidth) },
i = d.createElement("div"),
s = "position:fixed;top:0;right:0;padding:4px 6px;z-index:999999;opacity:.8;background:#000;color:#fff;font:15px HelveticaNeue";
i.setAttribute("style", s);
i.innerHTML = sw() + "px";
d.querySelector("body").appendChild(i);
if (w.addEventListener)
w.addEventListener("resize", function() { go(sw) });
else if (w.attachEvent)
w.attachEvent("onresize", function() { go(sw) });
else
w.onresize = function() { go(sw) };
function go() {
i.innerHTML = sw() + "px";
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment