I have made a quick Jsbin: http://jsbin.com/ujabew/edit#javascript,html,live
What i\'m trying to achieve is to find out which is the largest
This was my idea:
$(document).ready(function () {
var elements = $(".content ul li");
var count = elements.length - 1;
var width = [];
elements.each(function (n) {
width.push($(this).outerWidth(true));
if (count == n) {
width = Math.max.apply(Math, width);
}
});
});
I added the count of the number of elements and then runs the Math.max
to get the largest number when each loop is done.