When I alert the value .position().left
, it returns 0 on Chrome. With other browsers it returns the actual number. Why does this happen?
Webkit based browsers (like Chrome and Safari) can access images width
and height
properties only after images have been fully loaded. Other browsers can access this information as soon as just the DOM is loaded (they don't need to load the images entirely to know their size).
So, if you have images in your page, with Webkit based browsers you should access offset
information after the $(window).load
event fires, and not after the $(document).ready
event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With