Created
September 12, 2021 01:13
-
-
Save marklchaves/781825a61702c0f660c7e3eb9b89c9c9 to your computer and use it in GitHub Desktop.
Avada Equal Height Testimonials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Ignore this first line when copying to your child theme's functions.php file. | |
function my_custom_equal_height_testimonials_script() | |
{ ?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
function makeEqualHeights() { | |
let maxHeight = Math.max(... | |
$(".review").map(function() { | |
return $(this).height(); | |
}) // map() | |
); // Math.max | |
// Make the parent and children heights the same. | |
$(".reviews").height(maxHeight); | |
$(".review").height(maxHeight); | |
} // makeEqualHeights | |
window.onload = makeEqualHeights; | |
window.onresize = makeEqualHeights; | |
}); // jQuery | |
</script> | |
<?php } | |
add_action('wp_footer', 'my_custom_equal_height_testimonials_script', 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment