var imgArr; $(document).ready(function(){ preload(["/vehiclephotos/1090149/huge/f69ab27b-eed9-4b8a-abde-55b509dfaca4.jpg", "/vehiclephotos/1090149/huge/4aab177b-505e-4473-acc3-f386ad70bfd8.jpg", "/vehiclephotos/1090149/huge/e3b9a995-0936-47e3-9ae6-a767959dbdc4.jpg", "/vehiclephotos/1090149/huge/362b6f75-1082-47bd-872b-73518864a573.jpg", "/vehiclephotos/1090149/huge/1e27cfaa-f5a8-4d05-b028-703992d8c135.jpg", "/vehiclephotos/1090149/huge/aefb140b-a3f6-46b1-ba5d-7528c13f9838.jpg", "/vehiclephotos/1090149/huge/830892cf-0b48-42a2-a890-2c3c1a9198ed.jpg", "/vehiclephotos/1090149/huge/be44670a-f189-4af0-aaf4-bc89cc293111.jpg", "/vehiclephotos/1090149/huge/215f606b-d51b-4129-ae57-732f499a380e.jpg", "/vehiclephotos/1090149/huge/0f0efdc1-65d3-481b-a21e-84a507eeac97.jpg", "/vehiclephotos/1090149/huge/168da3f4-c145-4be5-ab34-b4f3a48aed3c.jpg", "/vehiclephotos/1090149/huge/f7cd6cfd-67e4-4645-9432-92aecd5bc916.jpg"]); $("#photo-main").attr("src","/vehiclephotos/1090149/huge/f69ab27b-eed9-4b8a-abde-55b509dfaca4.jpg"); }); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('')[0].src = this; }); imgArr = arrayOfImages; }