Reputation: 131
I want to load the js first and the images second. Reason: I want the blue rollover affect to be applied immediately. There will eventually be double the images currently on this page so it will eventually be a bigger user experience problem as it grows.
Any ideas?
http://www.rollinleonard.com/elements/
Upvotes: 0
Views: 436
Reputation: 156444
If both your JS and images are linked directly from the HTML (meaning you're using the typical <script type="javascript" src=...>
and <image src=...>
tags) then the load order is entirely up to the user's web browser (as far as I know).
Your best chance to control the load ordering is to load the JavaScript per usual and then have custom JS to manipulate the DOM to load the images later, e.g.:
var myDiv = document.getElementById("myImageHoldingDiv")
, img = new Image();
img.onload = function() {
myDiv.appendChild(img);
}
img.src = myImageUrl;
Upvotes: 2