Link to home
Start Free TrialLog in
Avatar of BILL Carlisle
BILL CarlisleFlag for United States of America

asked on

Auto height calculations

Hi,
 I figured how to size one region based on the other region size but I need to give the region a minimum size

$('#charges_region').height($('#checkin_amounts').height()); 

Open in new window


checkin_amounts is a report that could be zero rows so I need charges_region to be minimum 120px
If checkin_amounts has 20 rows then charges_region grows along with checkin_amounts region (although it is a couple of px short)

How would I check $('#checkin_amounts').height() to see if it is 120px or more without a lot of code.. I could do it with a if statement etc.. but should be a shorter way. And can I add a couple px to the result if it is over 120?

Is there a way to do it as CSS ? :-)



Thank you, Bill
ASKER CERTIFIED SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BILL Carlisle

ASKER

Awesome! thank you..

How can I change this jQuery to be inline CSS?
$('#charges_region').height($('#checkin_amounts').height()+2);

Open in new window


????

#charges_region {
   height: $('#checkin_amounts').height()+2 ;
   min-height: 300px;

Open in new window

It is good enough, the jQuery.css has a bit delay.. but the min-height did it for me.
Thx