с использованием jQuery:
$(function() {
function unifyHeights() {
var maxHeight = 0;
$('#container').children('#navigation, #content').each(function() {
var height = $(this).outerHeight();
// alert(height);
if ( height > maxHeight ) {
maxHeight = height;
}
});
$('#navigation, #content').css('height', maxHeight);
}
unifyHeights();
});
There is a syntax for that:
def arbitrary(&block)
values = [1, 2, 3, 4]
if block
values.each do |v|
yield v
end
else
values
end
end
Note:
yield v
Can be replaced with:
block.call v
def arbitrary
values = [1,2,3,4]
return values unless block_given?
values.each { |val| yield(val) }
end
arbitrary { |x| puts x }
arbitrary