eozzy
eozzy

Reputation: 68670

Finding max-height of an element

Is there any way to find out the pre-defined max-height (css property) of an element?

I want to find the height with .height() and compare with css max-height and add add class if max-height reached.

Upvotes: 0

Views: 82

Answers (2)

antejan
antejan

Reputation: 2624

You can use .css('max-height') but if you want a number you have to drop "px" (or other unit) part:

parseInt($("element").css('max-height'),10)

Upvotes: 1

SeanCannon
SeanCannon

Reputation: 77976

$('#myDiv').css('max-height');

Demo: http://jsfiddle.net/F9DPh/

Upvotes: 3

Related Questions