1

If you have an unordered list full of LI elements, all the same width, how can you calculate the width of the UL so you can set it the right width to accomidate all the LI elements on a single line?

1 Answer 1

1

I was getting lazy here's the answer:

var width = 0;
$('div.sliderGallery ul li').each(function() {
width += $(this).outerWidth( true );
            });
$('div.sliderGallery ul').css('width', width);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.