Last active
December 24, 2018 11:56
-
-
Save Farmatique/f277e584188440aae56421ab477a30e1 to your computer and use it in GitHub Desktop.
Equalize or set the height of block to fit maximum height in set of blocks
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
| function matchHeight(wrapperEl, matchEl){ | |
| var maxHeight = 0; | |
| var element = jQuery(wrapperEl); | |
| jQuery(element).find(matchEl).each(function(index, element){ | |
| // reset previous min-height | |
| jQuery(this).css('min-height', 0); | |
| if (jQuery(this).outerHeight() > maxHeight) { maxHeight = jQuery(this).outerHeight(); } | |
| }); | |
| jQuery(element).find(matchEl).css('min-height', maxHeight); | |
| } | |
| //apply function on load and resize | |
| jQuery(window).on('load resize', function(){ | |
| matchHeight('.pro-section', '.pro-section-single'); | |
| matchHeight('.whycrown-section_blocks', '.whycrown-section-block'); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment