var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1078377/huge/ae70070b-ec33-4b22-837a-94b640c9159f.jpg", "/vehiclephotos/1078377/huge/a0dca882-e27c-4ccb-a6c2-46bfdb9992f3.jpg", "/vehiclephotos/1078377/huge/00e4845f-a595-46f2-be5d-beb620ee54eb.jpg", "/vehiclephotos/1078377/huge/e442bfb1-4575-4a94-882c-a6af80de568e.jpg", "/vehiclephotos/1078377/huge/a20fee2a-1391-497d-b729-60568c6e5d49.jpg", "/vehiclephotos/1078377/huge/57a24128-6c87-42fd-aaec-c23df3153531.jpg", "/vehiclephotos/1078377/huge/a85d7ee4-4f62-44ba-a35d-1bfd14aec3f4.jpg", "/vehiclephotos/1078377/huge/c6b126f6-e7c5-43b0-a684-f26f633341bd.jpg", "/vehiclephotos/1078377/huge/1e53025a-4f8f-469f-af8b-5538d144f573.jpg", "/vehiclephotos/1078377/huge/4dae53ba-3862-4d67-8458-3be49c2d4518.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1078377/huge/ae70070b-ec33-4b22-837a-94b640c9159f.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }