Last active
August 29, 2015 13:55
-
-
Save drifterz28/8694115 to your computer and use it in GitHub Desktop.
Detect and show window size in upper left of page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| // I know chrome does this but I would like it to stay around. | |
| // update, chrome does not do this any more. | |
| var scaler, | |
| scaleWrapper = ['<div id="scaleShow"', | |
| 'style="position:fixed;background:#fff;top:0;left:0;padding:5px;opacity:0.6;">', | |
| window.innerWidth + 'px x ' + window.innerHeight + 'px - ' + window.devicePixelRatio, | |
| '</div>'].join(' '); | |
| document.body.insertAdjacentHTML('beforeend', scaleWrapper); | |
| scaler = document.getElementById('scaleShow'); | |
| window.addEventListener('resize', function () { | |
| scaler.textContent = window.innerWidth + 'px x ' + window.innerHeight + 'px'; | |
| }); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment