K
K
KennySP2015-10-06 11:18:32
JavaScript
KennySP, 2015-10-06 11:18:32

How to align blocks by height in js?


https ://monosnap.com/file/yVK2NC77Y14EUYoRcEgo6Jk0... the height of the blocks was equal to the height of the longest

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Inchin ☢, 2015-10-06
@KennySP

This question comes up all the time.

var maxHeight = Math.max.apply(
   null, 
   $.map($("div"), function(e){
      return $(e).height();
   })
);

$("div").height(maxHeight);

Usage example

V
Vadim Bogomazov, 2015-10-06
@bogomazov_vadim

Habr

D
Dmitry Novikov, 2015-10-06
@dmitriy_novikov

on jquery - iterate over all blocks in a row with each, select the maximum height(), apply to all blocks in a row with css('height'). repeat for each line.

D
Dmitry, 2015-10-06
@Odinokun

Here is the working script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question