When I alert the value .position().left, it returns 0 on Chrome. With other browsers it returns the actual number. Why does this happen?
When I alert the value .position().left , it returns 0 on Chrome . With
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Webkit based browsers (like Chrome and Safari) can access images
widthandheightproperties 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
offsetinformation after the$(window).loadevent fires, and not after the$(document).readyevent.