calculate the width of an element when its children elements are loaded dynamically