javascript - Count number of rows inside a div element -
as shown in image below, have several div inside div (outer div). need count number of rows outer div have. in example row count 5.
note:the inner div floated left , content created dynamically.
does has ideas?
perhaps along lines of:
demo fiddle
var minleft = null, rows = 0; $('div div').each(function () { var left = $(this).offset().left; if (left <= minleft || minleft==null) { rows++; minleft=left; } }); console.log(rows);
Comments
Post a Comment