javascript - Columns child equal per row -


i have product gallery needs equal in height parent , child div.

i need calculate per row. i'm getting tallest child , applying on div. want highest div , apply row.

$(document).ready(function() {  var item_title_height = 0;  var item_details_height = 0;   $('.item-title').each(function(i, obj) {     if($(this).height() > item_title_height) {     item_title_height = $(this).height();   }  });   $('.item-details').each(function(i, obj) {     if($(this).height() > item_details_height) {     item_details_height = $(this).height();   }  });  $(".item-title").height(item_title_height); $(".item-details").height(item_details_height);  }); 

this fiddle

fiddle

hope can me

not sure how in jquery. find largest div vanilla. use window.getcomputedstyle styling info elements may not have explicit css or html style declarations.

var heights = array.prototype.slice.call(document.getelementsbyclassname('item-title')).map(function(i){     var cs = window.getcomputedstyle(i,null)     return parsefloat(cs.getpropertyvalue("height")) }); alert(math.max.apply(null,heights)) 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -