uksz
uksz

Reputation: 18699

How to automatically update divs height based on other div height?

I have following setup:

<div class="row">
  <div class="col-xs-6">
   <div id="first"> 
   </div>
  </div>
  <div class="col-xs-6">
   <div id="second">
   </div>
  </div>
</div>

In which, div with id first has height property set to auto. I want to be able to automatically detect change in height of the div with id first, and set height of div with id second to x-70px where x is height of div first.

How can I do this?

Upvotes: 2

Views: 57

Answers (1)

Wowsk
Wowsk

Reputation: 3675

Set the second div's height to the first div's height with jQuery.

$("#second").height($("#first").height());

Upvotes: 1

Related Questions