danny-d
7/4/2016 - 2:40 PM

Vanilla JS Match Height

Vanilla JS Match Height

function matchHeight() {
	function setHeight(elementH) {
		var maxH = 0;
		var len = $(elementH).length;
		$(elementH).css("min-height", "");

		$(elementH).each(function (index) {
			var curH = $(this).outerHeight();
			if (curH > maxH) {
				maxH = curH;
			}

			if ((index + 1) == len) {
				$(elementH).css({ "min-height": maxH });
			}
		});
	}

setHeight(".woocommerce ul.products li.product > a:first-child");
setHeight(".footer-widgets .widget-area");
setHeight(".woocommerce-page div.product div.thumbnails a");

}

function responsiveFn() {
	matchHeight();
}


$(window).load(responsiveFn).resize(responsiveFn);