开发者

I have JavaScript code at the bottom of the page but images still load after?

开发者 https://www.devze.com 2022-12-25 14:13 出处:网络
I\'m referencing my JavaScript files before the closing body tag, hoping they will be parsed last (as they\'re not needed until last). However when I analy开发者_如何学Cse activity with PageSpeed in F

I'm referencing my JavaScript files before the closing body tag, hoping they will be parsed last (as they're not needed until last). However when I analy开发者_如何学Cse activity with PageSpeed in Firebug, the images seem to be requested last.

How can I make the images higher priority than the JavaScript code?


When you execute your javascript commands in the onLoad-Event the images should be read first. After the page is fully loaded the onLoad-Event is executed.


Yes, document.ready is before images. If you want it to run after images are loaded you need to use

$(window).ready(function() {});


Load your images outside of the $.ready() function

0

精彩评论

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