Created
December 4, 2015 18:48
-
-
Save ghorvat/194cf17901ae16ca2563 to your computer and use it in GitHub Desktop.
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
jQuery(window).bind("resize load", function () { | |
jQuery(".middleCaptionSquareImageTile .image-item").each(function (i) { | |
var desc = jQuery(this).find(".image-description"); | |
var ovaj = jQuery(this); | |
var descHeight = jQuery(desc).outerHeight(); | |
var parentHeight = jQuery(desc).parent().outerHeight(); | |
var chi = jQuery(this).children(".image-description"); | |
jQuery(chi).each(function (m, el) { | |
console.log(el.clientHeight); | |
if (descHeight > parentHeight) { | |
var differenceInheight = descHeight - parentHeight; | |
console.log(differenceInheight); | |
if (jQuery(ovaj).children().hasClass("image-description")) { | |
jQuery(ovaj).children(".image-description").css({ | |
"overflow": "auto", | |
"max-height": descHeight - differenceInheight * 20 | |
}); | |
} | |
} else if (el.clientHeight < parentHeight) { | |
if (jQuery(ovaj).children().hasClass("image-description")) { | |
jQuery(ovaj).children(".image-description").css({ | |
"overflow": "normal", | |
"max-height": "auto" | |
}); | |
} | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment