Accepted answer

This was nothing to do with getBoundingClientRect() but certainly something to be aware of.

In the window-resize function, the function containing the getBoundingClientRect() was being called immediately. I needed to set a timeout to ensure the resize had been finished by the browser so that the correct dimensions were then returned.

Definitely worth knowing

Related Query