Return to Snippet

Revision: 40626
at February 8, 2012 04:33 by typomatic


Updated Code
// Usage: $( elements ).equalHeights();
(function($){
	$.fn.equalHeights = function() {
		var max = 0;
		return this
			.each(
				function(){
					max = Math.max( max, $(this).height() );
				})
				.css({
					'height': max
				});
	};	
})(this.jQuery);

Revision: 40625
at October 14, 2011 10:43 by typomatic


Updated Code
(function($){
	$.fn.equalHeights = function() {
		var max = 0;
		return this
			.each(
				function(){
					max = Math.max( max, $(this).height() );
				})
				.css({
					'height': max
				});
	};	
})(this.jQuery);

Revision: 40624
at April 8, 2011 02:39 by typomatic


Updated Code
(function($){
	$.fn.equalHeights = function(){
		var tallest = 0;
		this.each(function(){
			var thisHeight = $(this).innerHeight();
			if (thisHeight > tallest) tallest = thisHeight;
		});
		return this.css({
			'height': tallest
		});
	};	
})(this.jQuery);

Revision: 40623
at February 5, 2011 07:04 by typomatic


Updated Code
(function( $ ){

	$.fn.equalHeights = function( options ) {

		var tallest = 0
			settings = {
				'includeMargins' : false
			};
			
		if (options) $.extend( settings, options );

		return this
			.each(function(){
				var thisHeight = $(this).outerHeight(settings.includeMargins);
				if (thisHeight > tallest) tallest = thisHeight;
			})
			.css({
				'overflow': 'auto',
				'height': tallest
			});
	};

})(jQuery);

Revision: 40622
at February 5, 2011 05:52 by typomatic


Updated Code
(function($){
			
				$.fn.equalHeights = function( options ) {
					
					settings
			
					var tallest = 0;
			
					return this.each(function(){
							var thisHeight = $(this).outerHeight();
							if (thisHeight > tallest) tallest = thisHeight;
						})
						.css({
							overflow: 'auto',
							height: tallest
						});
					};
			
			})(jQuery);

Revision: 40621
at February 4, 2011 12:09 by typomatic


Initial Code
(function($){
	
	$.fn.equalHeights = function() {
		
		var tallest = 0;

		this.each(function(){
			var thisHeight = $(this).height();
			if (thisHeight > tallest) tallest = thisHeight;
		});
		
		return this.each(function() {
			$(this).height(tallest).css("overflow","auto");
		});

	};
	
})(jQuery);

Initial URL


Initial Description
A basic plugin to equalize the heights of a collection of elements.

Initial Title
Basic Equalize Heights Plugin

Initial Tags


Initial Language
jQuery