I'm attempting to adjust the height of a container based on the position of its last child using Isotope, infinite scroll, and Packery. Below is a snippet of the code:
<html>
<div id="container" class="variable-sizes isotope" style="position: relative; overflow: hidden;">
<div class="isoItem isotope-item" style="position: absolute; height: 0px; left: 0px; top: 0px;"> </div>
<div class="isoItem" style="position: absolute; left: 0px; top: 0px;"></div>
<div class="isoItem" style="position: absolute; left: 340px; top: 0px;"></div>
<div class="isoItem" style="position: absolute; left: 680px; top: 0px;"></div>
<div class="isoItem" style="position: absolute; left: 1020px; top: 0px;"></div>
<div class="isoItem" style="position: absolute; left: 1190px; top: 0px;"></div>
<div class="isoItem" style="position: absolute; left: 1360px; top: 2089px;"></div>
</div>
</html>
My goal is to achieve something similar to this:
$('#container').css('height', $('.isoItem:last').css('top') + '317px');
In this example, the #container
height would be adjusted to 2089px + 317px = 2415px
Any assistance with this matter would be greatly appreciated.