开发者

Images loaded after $(document).ready in webkit browsers' refresh

开发者 https://www.devze.com 2023-02-16 22:44 出处:网络
I have a case where it seems that the contents of $(document).ready are being executed before the page is actually loaded. This happens when the page is REFRESHED in WEBKIT browsers. What\'s going on

I have a case where it seems that the contents of $(document).ready are being executed before the page is actually loaded. This happens when the page is REFRESHED in WEBKIT browsers. What's going on with that?

It's messing with my offset() calculations because the calculation is made before all of the CSS is ap开发者_StackOverflow中文版plied.


If you are processing images, $(document).ready may start executing before the images are fully loaded...if this is the case use $(window).load instead!


$(document).ready() is invoked when the DOM is fully loaded. Now that doesn't necessarily mean your page is fully loaded - e.g. background images in the CSS may still be loading.


I've had similar problems with refreshing a page (especially with Chrome), and I've found that by simply moving the CSS link above the script, so that it loads first, resolved all issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消