Trying to determine the height of multiple ul elements in an HTML structure and set the maximum height for all. Currently, the code I'm using is setting the height to 0 for both ul elements. How can I adjust it to set the max height for both uls? In my CSS, I have used .col-sm-2.list-unstyled with float:left as well.
HTML
<ul class="dropdown-menu">
<li>
<!-- Content container to add padding -->
<div class="yamm-content">
<div class="row">
<ul class="col-sm-2 list-unstyled">
<li>
<a href="/residential/en/us/about/">About Carrier</a>
</li>
<li>
<a href="/residential/en/us/about/corevalues/">Core Values</a>
</li>
<li>
<a href="/residential/en/us/about/fact-sheet/">Fact Sheet</a>
</li>
<li>
<a href="/residential/en/us/about/willis-carrier/">Willis Carrier</a>
</li>
<li>
<a href="/residential/en/us/about/history/">Carrier History</a>
</li>
</ul>
<ul class="promotions-block menupromotion col-sm-2 list-unstyled hidden-xs">
<li class="holder col-lg-12 col-md-12 col-sm-4">
<div class="promo_wrpr">
<a class="inpage-module-link" href="http://www.naturalleader.com" target="_blank">
<section class="promo_img_hldr">
<img src="demo/img/natural-leadership-sustainability-utc-82x76.jpg"
title="Learn about Natural Leadership and Sustainability at United Technologies Corporation"
alt="Learn about Natural Leadership and Sustainability at United Technologies Corporation"
class="img-responsive">
</section>
<div class="promo-text">
<h3>
<strong>NATURAL LEADERSHIP</strong>
</h3>
<span class="common-cta rightarrow">
Learn about sustainability
<span class="link-2liner">
</span>
</span>
</div>
</a>
</div>
</li>
</ul>
</div>
</div>
</li>
</ul>
JS part
var b = $(".col-sm-2.list-unstyled").length;
var c=0;
$(".col-sm-2.list-unstyled").each(function() {
if ($(this).height() > c) {
c = $(this).height()
}
});
for (var a = 0; a < b; a++) {
$(".col-sm-2.list-unstyled").eq(a).removeAttr("style")
$(".col-sm-2.list-unstyled").eq(a).height(c)
}
If you have any suggestions on how to fix this issue, please let me know. Thank you!