Skip to content

Instantly share code, notes, and snippets.

@kruzyk
Created January 29, 2019 12:30
Show Gist options
  • Select an option

  • Save kruzyk/c7aa3fbd4d8c7d13a47ea933ba073713 to your computer and use it in GitHub Desktop.

Select an option

Save kruzyk/c7aa3fbd4d8c7d13a47ea933ba073713 to your computer and use it in GitHub Desktop.
Debugger that shows view port size. Helps when making responsive designs.
// -----------
// Debugger that shows view port size. Helps when making responsive designs.
// -----------
function showViewPortSize(display) {
if(display) {
var height = window.innerHeight;
var width = window.innerWidth;
jQuery('body').prepend('<div id="viewportsize" style="z-index:9999;position:fixed;bottom:0px;left:0px;color:#fff;background:#000;padding:10px">Height: '+height+'<br>Width: '+width+'</div>');
jQuery(window).resize(function() {
height = window.innerHeight;
width = window.innerWidth;
jQuery('#viewportsize').html('Height: '+height+'<br>Width: '+width);
});
}
}
$(document).ready(function(){
showViewPortSize(true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment