Answer the question
In order to leave comments, you need to log in
How to make blocks the same height when the browser window changes?
There is a little code so that the height of all blocks in one class is the maximum height in this set.
The function is called when the page is loaded and when the window is resized.
jQuery(window).resize(function() {
resizeBlockEach('.myclass');
});
function resizeBlockEach(classElement) {
var maxHeight = 0;
$(classElement).each(function(i,elem) {
if($(this).height() > maxHeight) maxHeight = $(this).height();
});
$(classElement).height(maxHeight);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question