views:

71

answers:

3

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 analyse activity with PageSpeed in Firebug, the images seem to be requested last.

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

+2  A: 

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.

schaechtele
i'm using jquery document.ready, so is that doing it before images?
Haroldo
@Haroldo: Yes, the document ready event will fire before images are loaded.
Andy E
you should try $(window).load(function() {};
schaechtele
+2  A: 

Yes, document.ready is before images. If you want it to run after images are loaded you need to use $(window).ready(function() {});

Alistair
A: 

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

Chris Love