var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1195410/huge/32809102-9847-41b8-989c-ea74548ea9a5.jpg", "/vehiclephotos/1195410/huge/d9bda4e3-2e06-4308-bb61-5b7f22431132.jpg", "/vehiclephotos/1195410/huge/6f1804a8-224c-49b8-a13f-bd2f70b63b3c.jpg", "/vehiclephotos/1195410/huge/3a33bb0d-6480-4e85-b147-5ee8d5f4f337.jpg", "/vehiclephotos/1195410/huge/a517a5f6-e5c6-4b2e-b6c2-48d11cd6d2cd.jpg", "/vehiclephotos/1195410/huge/32c94b36-27f8-423e-aa0b-2c8d482d3066.jpg", "/vehiclephotos/1195410/huge/3a1e9390-5127-4379-825c-1241c05dd639.jpg", "/vehiclephotos/1195410/huge/bce97bf5-5f29-4304-baff-3ddf31d33bea.jpg", "/vehiclephotos/1195410/huge/d1f83485-1e52-400d-83c7-66fd06d64605.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1195410/huge/32809102-9847-41b8-989c-ea74548ea9a5.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }