var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1156596/huge/678824f1-2ee9-4091-90ac-42cc3a64ab59.jpg", "/vehiclephotos/1156596/huge/d17448e8-d5b7-41c3-b581-16146a711100.jpg", "/vehiclephotos/1156596/huge/cb592c5a-e717-4639-9480-7785d33a225c.jpg", "/vehiclephotos/1156596/huge/5dcb8291-d4dd-4cce-ad2f-02a7fe85d5f1.jpg", "/vehiclephotos/1156596/huge/8be65c3e-b025-435b-813e-798bc63e6030.jpg", "/vehiclephotos/1156596/huge/08749ba7-cd12-4f84-9ce6-472bd44501de.jpg", "/vehiclephotos/1156596/huge/ffade654-e985-4273-a2bb-43f2a64fc86a.jpg", "/vehiclephotos/1156596/huge/9620b6ea-3220-4226-bf2d-da020a5d1ce4.jpg", "/vehiclephotos/1156596/huge/2654b652-0bfb-431e-b20b-61f3c6bdcb49.jpg", "/vehiclephotos/1156596/huge/6ee9f448-af0c-4815-bbed-96617509c94e.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1156596/huge/678824f1-2ee9-4091-90ac-42cc3a64ab59.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }