I'm trying to do some sort of tryptic where the first item in a list takes a bit more prominence over the second and third.
I've got it to the point where I'm adding the height of second and third and applying said height to the first item. But in trying to fool-proof the design, I need it to play nice in reverse.
For example, if the height of the first item is of greater value than the second+third item combined then apply the difference somewhere (second or third)...sorry if this all seems confusing.
Here is the code: http://codepen.io/randydaniel/pen/uKkfb
var equalHeights = function(cols) {
$(cols).each(function() {
var colTwo = parseInt($('#blog-listing li:nth-child(2)').css('height').replace("px", "")),
colThree = parseInt($('#blog-listing li:nth-child(3)').css('height').replace("px", ""));
var extra = colTwo + colThree;
$(cols).css('height',extra);
});
};
$(document).ready(function() {
equalHeights($("#blog-listing li:first-child"));
});
Disclaimer: I'm not too knowledgeable with javascript as I am re-purposing some code from a prior example and flexbox (if possible) isn't an option at the moment.
parseIntwill find the number in the string either way.