Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marklchaves/781825a61702c0f660c7e3eb9b89c9c9 to your computer and use it in GitHub Desktop.
Save marklchaves/781825a61702c0f660c7e3eb9b89c9c9 to your computer and use it in GitHub Desktop.
Avada Equal Height Testimonials
<?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