开发者

How to get height of the highest element in the div and set this height to the div?

I wr开发者_运维技巧ote small news ticker - http://jsfiddle.net/MrTest/SvFRs/

Problem which I have is that - there is content straigt after news div and I need to know the height of the heighest element in that div (and set this height to the div(parent) ), so I would avoid movement of element underneath it.

Please see my example - http://jsfiddle.net/MrTest/SvFRs/

Any help much appreciated.

Pete


You can get the max height using

var max = Math.max.apply(Math, $(".notice").map(
  function(){
    return $(this).height();
  }
));

And set it to the div

$(".noticeboard").height(max);


look this jsFiddle:

http://jsfiddle.net/NqGL9/

i made the background gray to see if it works

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜