Reputation:

Jquery and javascript height different to div

I have a container div around all the content in the site that dynamically stretches, have also got several other divs that stretch (all using the same method as 20 other sites I have).

Not matter what method is use with jQuery or JavaScript to get the height of the container, JavaScript and jQuery seem to return a value bigger that height of the container div.

Does anyone know why this would be happening?

Many Thanks

Upvotes: 0

Views: 404

Answers (2)

brianreavis
brianreavis

Reputation: 11546

What do you define as "height"? Are you wanting the borders and padding to be included in the calculation? Just padding? Borders, padding, and margins?

From what it sounds like, my hunch is saying you should be using the innerHeight() function:

$(element).innerHeight();

Documentation: http://docs.jquery.com/CSS/innerHeight

Upvotes: 1

AlexC
AlexC

Reputation: 9661

I use jquery in that works well :

Jquery and javascript height different to div

http://docs.jquery.com/CSS/height

Upvotes: 0

Related Questions