Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Search for rows in document with jQuery and equalize height
- function windowResizeCallback() {
- $('.row').each(function() {
- equalizeHeight($(this));
- });
- }
- // Looks for elements with 'eq-height' class and set to maximum height all of them
- function equalizeHeight(row) {
- var elems = row.find('.eq-height');
- if (elems.length < 2) { return; }
- elems.css('height','');
- var h_max = elems.height();
- elems.each(function() {
- h_max = $(this).height() > h_max ? $(this).height() : h_max;
- });
- elems.css('height', h_max);
- }
- // Call it on resize, just in case
- window.onresize = windowResizeCallback;
- windowResizeCallback();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement