Created
July 1, 2015 13:09
-
-
Save richmilns/930554488e9bfb61594f to your computer and use it in GitHub Desktop.
Display viewport dimensions
This file contains 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($) { | |
$(document).ready(showViewportSize); | |
$(window).resize(showViewportSize); | |
$('body').append('<div id="viewport__sizes"><span id="viewport__width"></span>x<span id="viewport__height"></span>'); | |
$('#viewport__sizes').css({ | |
'font-family':'arial', | |
'font-size':'30px', | |
'color':'rgba(0,0,0,0.3)', | |
'z-index':'9999', | |
'position':'fixed', | |
'right':'20px', | |
'bottom':'20px' | |
}); | |
function showViewportSize() { | |
var w = $(window).width(); | |
var h = $(window).height(); | |
$('#viewport__width').text(w); | |
$('#viewport__height').text(h); | |
} | |
})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use http://mrcoles.com/bookmarklet/ to make this into a bookmarklet!