We help IT Professionals succeed at work.

Auto height calculations

BILL Carlisle
on
345 Views
Last Modified: 2014-05-13
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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
BILL CarlisleAPEX Developer

Author

Commented:
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

BILL CarlisleAPEX Developer

Author

Commented:
It is good enough, the jQuery.css has a bit delay.. but the min-height did it for me.
Thx
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.