Last active
September 28, 2020 09:56
-
-
Save JRyven/8c00a5b1e1410c3bc6f970f3117d5506 to your computer and use it in GitHub Desktop.
jQuery Examples for Resizing
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
<script> | |
jQuery(document).ready(function($) { | |
// Set all Elms to Height of Tallest | |
function setEqualHeight(e) { | |
var t = 0; | |
e.each(function(){ | |
currentHeight = $(this).height(); | |
if (currentHeight > t) { | |
t = currentHeight | |
} | |
}); | |
e.height(t) | |
} | |
// On Window Resize | |
$(window).resize(function () { | |
// Unset All Heights | |
$('.TARGET_ELEMENTS').css('height', ''); | |
// If Screen Width is "Wide" | |
var screen_width = $(window).width(); | |
if (screen_width > 1280){ | |
// Call setEqualHeight | |
setEqualHeight($('.TARGET_ELEMENTS')); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment