javascript - Making the column height same and remove extra content -
i have question, webpage has many div section , have multiple ul li. 2 column design , need set same height both corresponding div section. example check image, 1 section , want set height shortest div , remove large div content. possible do?
i checked on internet getting set both column height unable find how can remove content.
the right image want.
please :)
assuming you're using jquery, try this:
var $targets = $('.awesomeclass'), targetheight = $targets.first().height(); $targets.each(function() { var $this = $(this); if( $this.height() < targetheight ) { targetheight = $this.height(); } }); $targets.height( targetheight );
this code set height of matching elements height of shortest member.
just make sure target elements have class awesomeclass
, or whatever class decide use, , add overflow: hidden;
overflowing elements cut off. method remain functional if decide change number of elements etc.
Comments
Post a Comment