Forked from jordanmoore/RWD Screen Width Indicator (em version)
Created
July 19, 2012 16:25
-
-
Save jedfoster/3145092 to your computer and use it in GitHub Desktop.
Current screen width indicator in EMs (useful for knowing when to add breakpoints when resizing browser window)
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
<script> | |
$(window).resize(function() { | |
var windowWidth = $(window).width(); | |
var bodyFontSize = $('body').css('font-size'); | |
var bodyFontSizeWithoutPx = parseInt(bodyFontSize); | |
var emValue = windowWidth/bodyFontSizeWithoutPx; | |
$('.screen-width').text(emValue + 'em'); | |
}); | |
</script> | |
<div id="debug" style="position:fixed;padding:0.3em 0.6em;background:#f1f1f1;font-size:0.6em;bottom:0;left:50%;"> | |
<span class="screen-width">0</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment