Hi I have four divs in a bootstrap row. I want all divs in this row to have the same height and not break responsibility. I don\'t know how to do this without breaking respo
I'm a bit late to the game, but....
This will align the heights of items in a row with a class of "row-height-matched". It matches the cells based on their top value so if they move underneath each other when the page gets smaller, I don't set the height.
I know there are a number of CSS versions out there, but all of them break my layout design.
$(window).resize(function () {
var rows = $(".row.row-height-matched");
rows.each(function () {
var cells = $(this).children("[class^='col-']");
cells.css("height", "");
var j = [];
cells.each(function () {
j.push($(this).offset().top);
});
var u = $.unique($(j));
u.each(function () {
var top = $(this)[0];
var topAlignedCells = cells.filter(function () {
return $(this).offset().top == top;
})
var max = 0;
topAlignedCells.each(function () {
max = Math.max(max, $(this).height());
})
topAlignedCells.filter(function () {
return $(this).height() != max;
}).height(max);
})
})
})