I have a bit of jQuery to get the size of a ul container, and automatically set the padding on each li to fill the space accordingly as each li is a different size. i have these variables set up to get the width of each li, but i can't work out how to get the total width of each li added together.
$('nav ul li').each(function() {
var $this = $(this),
width = $this.outerWidth();
$this.after($('<div>' + width + '</div>'));
});
The div after is just a test to check its getting the correct width. How do i add up the total width of each li? Thanks!