jQuery: The Write Less, Do More JavaScript Library

dimension of an object

View: New views
2 Messages — Rating Filter:   Alert me  

dimension of an object

by williamrouse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to find the dimension of a <div> named "content" and print
them to my screen.
I am getting the top and left, but not the width and height. Here is
what I have written so far:
$(document).ready(function(){
                var p = $("#content");
                var position = p.position();
                var h = $("#content").height($("body").width);
                var w = $("#content").width($("body").width);

                $("#content").text( "//n left: " + position.left + ",
top: " + position.top);
                $("#content").text( "/n");
                $("#content").text( "width: " + w +  "height: "  + h);
             ...

Re: dimension of an object

by Richard D. Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

var h = $("#content").height();
var w = $("#content").width();

- Richard

On Tue, Nov 3, 2009 at 4:39 PM, JamaicaMan <williambradley.rouse@...> wrote:
I am trying to find the dimension of a <div> named "content" and print
them to my screen.
I am getting the top and left, but not the width and height. Here is
what I have written so far:
$(document).ready(function(){
               var p = $("#content");
               var position = p.position();
               var h = $("#content").height($("body").width);
               var w = $("#content").width($("body").width);

               $("#content").text( "//n left: " + position.left + ",
top: " + position.top);
               $("#content").text( "/n");
               $("#content").text( "width: " + w +  "height: "  + h);
            ...