Created
December 17, 2021 13:28
-
-
Save greg-randall/0a5d5cbb79d8c5b276a363836204b318 to your computer and use it in GitHub Desktop.
Make some boxes on a website the same height. Add a common class name to the boxes, and swap out your class name for ".class-name-of-box". Requires jQuery.
This file contains hidden or 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
| <script> | |
| function equalHeight(group) { | |
| var tallest = 0; | |
| group.each(function() { | |
| var thisHeight = $(this).height(); | |
| if(thisHeight > tallest) { | |
| tallest = thisHeight; | |
| } | |
| }); | |
| group.height(tallest); | |
| } | |
| $(document).ready(function() { | |
| equalHeight($(".class-name-of-box")); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment