Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Boris Kamp
16,660 Pointsget height from the highest div and apply it to siblings
I came across this thread and found the great solution from Alex Thomas to work somewhat great. I made some slight changes an copied it over to this codepen
here's the javascript:
var h2height = $.makeArray()
var pheight = $.makeArray()
$('.container .behandeling .title').each(function(){
h2height.push($(this).outerHeight());
});
$('.container .behandeling .intro').each(function(){
pheight.push($(this).outerHeight());
});
$('.container .behandeling').each(function(){
$(this).find('.title').css('height', Math.max.apply( Math, h2height ));
$(this).find('.intro').css('height', Math.max.apply( Math, pheight ));
});
console.log('h2height = '+h2height);
console.log('highest h2height is ' + Math.max.apply( Math, h2height ));
console.log('pheight = '+pheight);
console.log('highest pheight is ' + Math.max.apply( Math, pheight ));
In the codepen it works great, you can see it in the console, it gets the highest height from both the heading and the paragraph.
Great I thought! until I copied it to my current WP install and applied in in a real life example as seen here (my beta site).
The height of the .title's get set perfectly, but the height of the .intro's get messed up.
I've been breaking my head over it but can't seem to figure it out.
what am I doing wrong???
2 Answers
Andrew McCormick
17,730 Pointsall the intros are set to the same height when I look at your site. What's messed up about them?
Boris Kamp
16,660 PointsAndrew McCormick, any thoughts?
Boris Kamp
16,660 PointsBoris Kamp
16,660 PointsAndrew McCormick yeah it's really weird, I can't really track where it's coming from. In Chrome on the .wpengine domain (link from first post) it show fine. As soon as I log in I get the same as the screenshot below. I thought it had to do with my admin bar somehow.
When I view my local version, logged in or logged out, I get the following as well, so the admin bar cannot be the issue. https://www.dropbox.com/s/uu1p6cw187d44xq/Screenshot%202016-07-12%2009.27.56%20copy.jpg?dl=0
any clues?