Created
March 28, 2012 12:55
-
-
Save aliaspooryorik/2225898 to your computer and use it in GitHub Desktop.
Displaying document width with jQuery
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
// fire event when window is resized | |
$( window ).resize( function() { | |
$body = $( 'body' ); | |
$documentWidth = $( '#document-width' ); | |
if ($documentWidth.length===0){ | |
$documentWidth = $( '<p id="document-width" />' ); | |
$body.prepend( $documentWidth ); | |
} | |
$documentWidth.text( $body.width() ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment