var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1196385/huge/4d839c18-09e3-46ee-83db-d8a81ef3fed6.jpg", "/vehiclephotos/1196385/huge/0a1ccfd3-2fff-4fce-8f67-3b307c129f8d.jpg", "/vehiclephotos/1196385/huge/393f746e-6bab-4149-a84c-68a50262a1fb.jpg", "/vehiclephotos/1196385/huge/f2b67983-3b9f-4165-8a95-87ddb1dff336.jpg", "/vehiclephotos/1196385/huge/a89b2e79-22e4-434c-a0bf-ae55d0d51e78.jpg", "/vehiclephotos/1196385/huge/ee54d33b-8582-4f50-bb00-8ddbc9d9c7cc.jpg", "/vehiclephotos/1196385/huge/ddb0f828-551a-4e95-8d89-98e7e3663a02.jpg", "/vehiclephotos/1196385/huge/382e8219-2ad3-4aa0-84e1-b82ba6e0b418.jpg", "/vehiclephotos/1196385/huge/0cb51dc1-3a8b-44ee-95f9-6901efbddcbb.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1196385/huge/4d839c18-09e3-46ee-83db-d8a81ef3fed6.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }