I want to compare two images side by side. I am trying to grab and store the heights of the first column, to apply the heights to the corresponding image in the other column.
Right now I can only get it to either get the first height or all of the height combined.
<div id="project">
<ul id="new">
<li> <img src="#" />New 1 </li>
<li> <img src="#" />New 2 </li>
<li> <img src="#" />New 3 </li>
<li> <img src="#" />New 4 </li>
<li> <img src="#" />New 5 </li>
</ul>
<ul id="old">
<li> <img src="#" />Old 1 </li>
<li> <img src="#" />Old 2 </li>
<li> <img src="#" />Old 3 </li>
<li> <img src="#" />Old 4 </li>
</ul>
</div>
Jquery to collect heights of ('#new li') and to display the height after the image in ('#old li'). I know that I have to change .append() to .css('height', theHeight)
$(function () {
$('#new li').each(function() {
theHeight = $(this).height();
$('#old li').each(function() {
$(this).append(theHeight + ' ');
});
});
});