Find out divs height and setting div height

后端 未结 9 944
天涯浪人
天涯浪人 2020-12-14 21:41

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

9条回答
  •  孤城傲影
    2020-12-14 22:05

    This is straight out of the jQuery documentation pages:

    $.fn.equalizeHeights = function(){
      return this.height( Math.max.apply(this, $(this).map(function(i,e){ return $(e).height() }).get() ) )
    }
    $('input').click(function(){
      $('div').equalizeHeights();
    });
    

提交回复
热议问题