Skip to content

Instantly share code, notes, and snippets.

@dannydickson
Last active July 31, 2018 20:34
Show Gist options
  • Save dannydickson/3a176f5e2d7915f8b89f3c9be3048e9f to your computer and use it in GitHub Desktop.
Save dannydickson/3a176f5e2d7915f8b89f3c9be3048e9f to your computer and use it in GitHub Desktop.
Vanilla JS Match Height
<script>
(function($) {
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(".et_pb_pricing_content ul");
}
function responsiveFn() {
matchHeight();
}
$(window).load(responsiveFn).resize(responsiveFn);
})( jQuery );
</script>
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment