开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜