var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1177821/huge/27e944e0-8576-4173-a18a-9e497240bbdb.jpg", "/vehiclephotos/1177821/huge/f9677053-7af2-48c7-a6aa-bbfdced04db0.jpg", "/vehiclephotos/1177821/huge/7c0f7d90-159f-44ae-98b0-dc1774b9c5af.jpg", "/vehiclephotos/1177821/huge/a26012f8-1d83-4997-948e-dfe6071f9fd2.jpg", "/vehiclephotos/1177821/huge/2e3aee27-d810-4100-9f8e-32845ede7f37.jpg", "/vehiclephotos/1177821/huge/4b40da76-e5c0-49a2-8b2b-3c03a29fe81f.jpg", "/vehiclephotos/1177821/huge/4e0f1a6d-5c0d-491f-94df-0ad41388a420.jpg", "/vehiclephotos/1177821/huge/4a676d9f-7c5d-4a85-91c7-013c7dc21cff.jpg", "/vehiclephotos/1177821/huge/0e091992-f939-4494-a44c-00e4037cbd7b.jpg", "/vehiclephotos/1177821/huge/a2c6bc38-b29e-4def-afa9-42a43d82ac05.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1177821/huge/27e944e0-8576-4173-a18a-9e497240bbdb.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }