Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active October 8, 2022 00:59
Show Gist options
  • Save Integralist/4713288 to your computer and use it in GitHub Desktop.
Save Integralist/4713288 to your computer and use it in GitHub Desktop.
Made a super quick bookmarklet for displaying the current screen dimensions for Chrome
javascript:(function(w, d){
var el = d.createElement('div');
el.setAttribute('style', 'position: fixed; right: 1em; top: 0; background-color: red; color: white; padding: 5px; z-index: 1000;');
el.innerHTML = d.documentElement.clientWidth;
d.body.appendChild(el);
w.addEventListener('resize', function(){
el.innerHTML = d.documentElement.clientWidth;
}, false);
}(window, window.document));
// minified version
/*
javascript:(function(w,d){var el=d.createElement("div");el.setAttribute("style","position: fixed; right: 1em; top: 0; background-color: red; color: white; padding: 5px; z-index: 1000;");el.innerHTML=d.documentElement.clientWidth;d.body.appendChild(el);w.addEventListener("resize",function(){el.innerHTML=d.documentElement.clientWidth},false)})(window,window.document);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment