I've seen various Q&As on various forums about pre-loading images here, but at my level of complete Javascript beginner...well, so many options are just confusing. I'm not sure even which apply to my situation, so I hope someone can give me a simple answer.
On my top page there's a link to a 'photos' page. On that page will be maybe 20 thumbnails. The user can click on any one and a bigger version will appear in the frame. I've put each large version on its own HTML page (not how the experts would do it, I'm sure, but it's sufficient). On each of the pages are back and forward arrows so the viewer can cycle through the bigger pics in the order of the thumbnails (I'm using LOWSRC, by the way).
What I want is to put some code on each page to pre-load the next and previous 2 (more?) pictures in the cycle, for the obvious reason. So can I just use the simple
<script language="javascript">
<!--
img01=newImage();
img01.src=images/image1.jpg;
img02=newImage();
img02.src=images/image2.jpg ;
...
//-->
</script>
on each page? I'm under the impression it doesn't work if the images are on another page (I'm wondering if a link can be followed to cache from a new page, even if the url is the same), but I could be completely misguided.
Also, if I preload images should I delete all the LOWSRC references?
Thanks for any help.
On my top page there's a link to a 'photos' page. On that page will be maybe 20 thumbnails. The user can click on any one and a bigger version will appear in the frame. I've put each large version on its own HTML page (not how the experts would do it, I'm sure, but it's sufficient). On each of the pages are back and forward arrows so the viewer can cycle through the bigger pics in the order of the thumbnails (I'm using LOWSRC, by the way).
What I want is to put some code on each page to pre-load the next and previous 2 (more?) pictures in the cycle, for the obvious reason. So can I just use the simple
<script language="javascript">
<!--
img01=newImage();
img01.src=images/image1.jpg;
img02=newImage();
img02.src=images/image2.jpg ;
...
//-->
</script>
on each page? I'm under the impression it doesn't work if the images are on another page (I'm wondering if a link can be followed to cache from a new page, even if the url is the same), but I could be completely misguided.
Also, if I preload images should I delete all the LOWSRC references?
Thanks for any help.
Comment