jquery - Equal height on each popups div -


how put equal heigts on each multiple divs?

<div class="brands">     <div class="left" style="height:50px;">different height 1 same group</div>     <div class="right" style="height:50px;">different height 2 same group</div> </div>  <div class="brands">     <div class="left" style="height:150px;">different height 3 same group</div>     <div class="right" style="height:150px;">different height 4 same group</div> </div> 

many thanks.

if want them same:

$('div.brands').children('div').css('height', '100px'); 

or, if different ones need different heights:

$('div.brands').eq(0).children('div').css('height', '50px'); $('div.brands').eq(1).children('div').css('height', '150px'); 

to set child divs height of tallest child div in given brands div:

var leftheight = 0; var rightheight = 0; $('div.brands').each(function() {     leftheight = $(this).children('div.left').height();     rightheight = $(this).children('div.right').height();     if(leftheight > rightheight) {         $(this).children('div.right').css('height', leftheight + 'px');     }     else {         $(this).children('div.left').css('height', rightheight + 'px');     }         }); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -