I am attempting to create a column height equalizer that works if it is the only instance on the page but if there is more than one instance the script appears to be ignoring the $(this)
in the each(){function
.
Here is the HTML:
<div class="equalizer" data-cols="2">
<div class="equalized ">Content</div>
<div class="equalized ">Content</div>
<div class="equalized ">Content</div>
<div class="equalized ">Content</div>
</div>
And the jQuery:
$(".equalizer").each(function() {
var colClass = 'eq-col-'+$(this).data("cols");
var height = parseInt($(this).css('height'));
$(this).children().each(function() {
$(this).css('height',height + 'px');
$(this).addClass(colClass);
});
});
This is the line that appears to be being ignore with more that one instance:
var height = parseInt($(this).css('height'));
It's purpose ids to get the height of the wrapper .equalizer
for that instance which in turn is set as the height for each child equalized
.
It appears that the script is acquiring the height from the tallest equalizer
wrapper on the page and setting the height for all equalized
children on the page equal to that height regardless of which wrapper it is in... I've been messing around with this for several hours and am at a loss... any assistance would be greatly appreciated.