Skip to content

Instantly share code, notes, and snippets.

@mperlet
Created December 17, 2020 07:28
Embed
What would you like to do?
jQuery calculate parent height by sum up childrens height
var parentHeight = $.map($('.parent > *'), function (i) {
return ($(i).height())
}).reduce(function (accumulator, currentValue) {
return accumulator + currentValue;
}, 0);
$('.parent').height(parentHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment