I\'m quite new to javascript/jquery stuff, but i would like to do this kind of thing with it:
I have four divs side-by-side like this and content in each one. Now if
This is simple code
var heights = $("element").map(function ()
{
return $(this).height();
}).get(),
MaxHeight = Math.max.apply(null, heights);
or
var highest = null;
var hi = 0;
$(".testdiv").each(function(){
var h = $(this).height();
if(h > hi){
hi = h;
highest = $(this);
}
});
highest.css("background-color", "red");
I believe you are looking for this plugin: equalizeBottoms by Ben Alman
Well you can get and set the height with height()
height = $('#id').height()
Loop through the elements and check the height, e.g.:
$elements = $('.container');
var max_height = 0;
for ($element in $elements) {
if (max_height > $element.height()) max_height = $element.height();
}
$elements.height(max_height);