I've found if I have an element of display: none
and I set it to "block", many browsers will have a slight delay before the element has an actual size console.log(element.offsetWidth === 0)
.
I've always created an interval or timeout checked that keeps polling until it has a size. But this is a hack.
Is there an actual event or some way to tell the browser to do something only when it has finished giving it display and layout?