same height (ok)

https://gist.github.com/filipecsweb/9c3649c7c8e4f8ed3d3e

/**
 * Define parameters to set 'where' and what 'element' will have same height. 
 *
 * @author  Filipe Seabra
 * @param   where       element's father
 * @param   element     selector of the elements that must have same height
 */
jQuery(window).load(function(){  
	function sameHeight(where, element){
		var height = [];
		var maxHeight = 0;

		jQuery(where).find(element).each(function(index){
			height[index] = jQuery(this).outerHeight();
			if(height[index] > maxHeight){
			maxHeight = height[index];
			}
		}).css('min-height', maxHeight);
	}
    
	sameHeight('.where', 'div.element'); // Just an example
});

Last updated

Navigation

Lionel

@Copyright 2023