I have a project that needs to get the logo's dimension and adjust its position accordingly. From what I understand, all the elements on the page should be ready for use right after $(document).ready
or onload
event. I also tried to put the script before the closing body tag to make sure I can get everything. I use jQuery $(element).width
and $(element).height
to measure the logo image.
However, I am not getting these value every time: I console log these two values. Sometimes, it shows me zero which I guess the image tag is loaded, but the actual image is still loading. I am so confused because I search online, they all say all the elements should be ready if I use DOM ready or put the script tag in the end.