Reputation: 311
I'm trying to reset the max height of a <p class="product_description">
in a set of responsive bootstrap columns. However, this code only seems to work on initial document load and not the resize event. What am I missing?
function DoEqualSizer(myclass) {
var heights = $(myclass).map(function() {
$(this).height('auto');
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$(myclass).height(maxHeight);
};
function EqualSizer(myclass) {
$(document).ready(DoEqualSizer(myclass));
window.addEventListener('resize', DoEqualSizer(myclass));
};
EqualSizer('.product_description');
Upvotes: 0
Views: 330
Reputation: 5707
Try to modify it as:
function EqualSizer(myclass) {
$(document).ready(DoEqualSizer(myclass));
window.addEventListener('resize', function() { DoEqualSizer(myclass); });
};
Upvotes: 1