Created
July 3, 2018 11:37
-
-
Save koanvl/e3cea06dc296d303cea3e37a5ab81f97 to your computer and use it in GitHub Desktop.
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
/*MediaAutoheight*/ | |
function MediaAutoheight(){ | |
var minHeight = 0; | |
var windowWidth = window.innerWidth; | |
var mediaObject = $(".media-autoheight"); | |
if (windowWidth >= 993){ | |
mediaObject.each(function(){ | |
var height = parseInt($(this).height()); | |
if (height > minHeight){ | |
minHeight = height; | |
} | |
mediaObject.height(minHeight); | |
}); | |
} | |
if (windowWidth <= 992){ | |
mediaObject.css("height", "auto"); | |
} | |
}; | |
$(window).resize(function(){ | |
MediaAutoheight(); | |
}); | |
MediaAutoheight(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment