I just came across a solution for this, what you do, instead of relying on jQuery to do it for you. Instead, get the javascript element and pull out the height of the element itself, as shown below:
var img = hiddenDiv.children('img'); var imgHeight = img.get(0).height; var imgWidth = img.get(0).width;
The jQuery get(0) method allows us to get the basic DOM element and, interestingly, the dimensions of the DOM elements do not change.
One point, but for performance reasons, you need to cache img.get(0) if you plan to use it more.
jQuery get method documentation
Samuel Mburu
source share