jQuery position problem with Chrome

google-chrome, jquery, position

Solution

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.

Problem

When I alert the value `.position().left`, it returns 0 on Chrome. With other browsers it returns the actual number. Why does this happen?

Original source