JSFiddle - React, Tailwind, and code Playground
by userdude
HTML
<div id="wrapper">
<div class="image" style="width: 100px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
<div class="image" style="width: 80px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
<div class="image" style="width: 70px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
<div class="image" style="width: 120px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
<div class="image" style="width: 55px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
<div class="image" style="width: 90px;"><img src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"></div>
</div>
CSS
#wrapper div {
width: 1px solid #bbb;
background-color: #ddd;
}
#wrapper div img {
width: 100%;
height: 100%;
}
JavaScript
function getMaxChildWidth(sel) {
max = 0;
$(sel).children().each(function(){
c_width = parseInt($(this).width());
if (c_width > max) {
max = c_width;
}
});
return max;
}
alert(getMaxChildWidth('#wrapper'));