Open jamminjames opened 7 years ago
Just iterate over all your images and call cacheFile
for each one. Up to you then to keep in memory the array of DOM elements/urls you have stored in the cache to be able to retrieve the images later.
@chrisben, thanks for the response!
So, would it be possible to create an array using the:
$('img').each(function() { ImgCache.useCachedFile($(this)); });
method, rather than the ImgCache.cacheFile('http://my-cdn.com/users/2/profile.jpg');
method for individual images?
You say "call cacheFile
for each one" ... could you give me the specific code for how to do that? (Newbie alert!)
What I'm trying to do is create a variable for each cached image that I can then insert in a js slideshow's (PhotoSwipe) array which calls the images. (I'm importing the images from a server, they are not included in the app itself.)
Thanks for any help!
The directions give an example of caching single images (
ImgCache.cacheFile('http://my-cdn.com/users/2/profile.jpg');
), but is it possible to cache all images in a folder? Or create an array of cached images? How would you do it?