var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1130071/huge/db8a0c73-3de7-4b5b-801c-81cbff1cce33.jpg", "/vehiclephotos/1130071/huge/c2029432-0340-41e2-875f-154b5fe1c510.jpg", "/vehiclephotos/1130071/huge/dc7af0c6-e997-4af7-b369-9b88c7cb3534.jpg", "/vehiclephotos/1130071/huge/95dfd799-cf4b-4943-aaf3-7327db6bd46d.jpg", "/vehiclephotos/1130071/huge/38918598-e9c5-4b70-a335-1159ed6f6367.jpg", "/vehiclephotos/1130071/huge/8b882c7a-332c-4a3c-bf54-625c9884fe52.jpg", "/vehiclephotos/1130071/huge/2b1c7df3-eb29-4356-a11f-644caaff1d25.jpg", "/vehiclephotos/1130071/huge/5b4d0372-d64d-4692-8e0a-c3719f3f1756.jpg", "/vehiclephotos/1130071/huge/6aa68086-bc46-4051-bfeb-3595c5b55bb1.jpg", "/vehiclephotos/1130071/huge/33abd7d5-d4fd-46d4-b491-a67eb4c6f655.jpg", "/vehiclephotos/1130071/huge/3c19979e-ba98-4362-912a-eed345f31d90.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1130071/huge/db8a0c73-3de7-4b5b-801c-81cbff1cce33.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }