Skip to content

Instantly share code, notes, and snippets.

@elpuas
Created February 1, 2018 18:11
Show Gist options
  • Select an option

  • Save elpuas/41e57caf4c7bb96362789c1c28f16513 to your computer and use it in GitHub Desktop.

Select an option

Save elpuas/41e57caf4c7bb96362789c1c28f16513 to your computer and use it in GitHub Desktop.
Add equal height to columns
var whiteBackground = $('.mdo--servicesChild__js--selector');
if( whiteBackground.length > 0 ) {
// console.log('Si Existe');
// Select and loop the container element of the elements you want to equalise
whiteBackground.each(function(){
// Cache the highest
var highestBox = 0;
// Select and loop the elements you want to equalise
$('.wpb_wrapper', this).each(function(){
console.log(this);
// If this box is higher than the cached highest then store it
if($(this).height() > highestBox) {
highestBox = $(this).height();
// console.log(highestBox);
}
});
// Set the height of all those children to whichever was highest
$('.mdo--servicesChild__js--selector:first-child > .wpb_wrapper').css({"height" : (highestBox + "px")});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment