Find the “potential” width of a hidden element

The width of an element that has CSS visibility: hidden is measurable. It’s only when it’s display: none that it’s not rendered at all. So if it’s certain the elements are going to be absolutely-positioned (so they don’t cause a layout change when displayed), simply use css('visibility', 'hidden') to hide your element instead of hide() and you should be OK measuring the width.

Otherwise, yes, show-measure-hide does work.

Leave a Comment