Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery height of element.style

Tags:

jquery

css

How do I get height of DIV, that is set by jQuery?
$('.bar2').animate({'height':'58' + "%"},1500);

When I inspect elements in chrome I see that my DIV height is set to 58%

<div class="bar2" style="height: 58%; background-image: ......>

I have tried this:

var bar2 = $(".bar2").height(), or var bar2 = $(".bar2").css('height'),

but I always get my "min-height" which is 70px, not height that is set by jQuery

like image 931
Mario LIPCIK Avatar asked Jun 27 '12 16:06

Mario LIPCIK


1 Answers

I think you would use:

$(".bar2").outerHeight();

Which is the computed height or

$(".bar2").innerHeight();

If you don't need to take account margin and padding and what-not.

like image 75
Matthew Riches Avatar answered Sep 21 '22 21:09

Matthew Riches