Find item by css property

I have divone that contains about 100 other elements div. Each element divhas properties topand left. How to find divwhich have the greatest properties left?
I need a better performance. Thank you

+5
source share
1 answer

Try it,

Live demo

var divWithTopLeft = null;
var maxLeft = 0;
$('div').each(function(){
    left = this.style.left.replace('px','');
    if(left > maxLeft )
    {
         maxLeft = left;
         divWithTopLeft = this;
    }   
});
+3
source

All Articles