I have a callback from an ajax call that returns a bunch of image links. I store this array in a variable (called fullPeopleList) and then on the click of a link, i show all of the images in the DOM. something like this:
function ShowAllPeople() {
var html = [];
$.each(fullPeopleList, function (i, person) {
html.push("<img title='" + person.Name + "' height='45' width='45' src='" + person.SafePicLink + "' /> ");
});
html.push(" <a id='showTop' href=''>Show Less ...");
$("#people").html(html.join(""));
}
the issue is that when i click on the list to show all of the people it takes a while to actually load all of the pictures so it shows the ugly browser empty placeholder box for each image until the images each load one by one
Is there anyway i can load these images in the background when i get the initial list so when i click on the "Show" link they are show up quickly ?