Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Finding the Dimensions of the Window and Document

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 440
    Comment on it

    You want to get the width and height of the window and document in pixels.

    jQuerys width and height methods provide easy access to the basic dimensions of the window or document:

    $(function() {
    alert('Window height:'+jQuery(window).height()); // returns the height of the viewport
    alert('Window width:'+jQuery(window).width()); // returns the width of the viewport
    alert('Document height:'+jQuery(document).height()); // returns the height of the document
    alert('Document width:'+jQuery(document).width()); // returns the width of the document
    });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: