javascript - How to determine whether floated element has wrapped -


i have 4 divs. of them float:left; example, can be:

[div id=1][div id=2][div id=3][div id=4]

or

[div id=1][div id=2][div id=3]
[div id=4]

in second case last div put next line there no space in parent. how can check if div id=4 next line. pure js or jquery. please, help.

there no easy way, have check position. comparing bottom value of element top value of element b safest method because errors can occur , top value isn't alway same.

this code check if div 4 in other line div 1 :

var = $('#1'), b = $('#4');  var posa = a.offset().top + a.height(), posb = b.offset().top;  if(posb > posa){     //div 4 in other line. } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -