- Apr 12, 2001
- 4,508
- 0
- 76
So I've been working on this survey site for a customer for some time now, and have one nagging bug. She wants the site setup so that when the user gets to the next survey question, the images for that question pop up right away. Each question has one or two images/photos. She doesn't like the download time. OK, that's a normal issue. I've already optimized the images, but it's not enough. There are Javascript methods to take care of this.
Enter the Image() function.
Here's some info on what I'm doing: link
So I set it up so that as the user goes through the site, the images for the NEXT question are loaded in the background while the user is looking at whatever question they are on. Pretty simple, it's all figured out in PHP and the database. Unfortunately the images are not being pre-loaded into the browser cache. Or if they are, they aren't being used for the next page. Here's a quick sample of the image loading code:
img1 = new Image();
img2 = new Image();
img1.src = "pics/ano27_image1.jpg";
img2.src = "pics/ano27_image2.jpg";
Has anyone here on the forum done something like this before? Any tips? Maybe I'm going about this all wrong. I've seen other Javascript sites set up to download everything, THEN display the page. It still takes time to do that though, and I think the person the site is for still might not like that approach.
thanks for any help.
-Josh
Enter the Image() function.
Here's some info on what I'm doing: link
So I set it up so that as the user goes through the site, the images for the NEXT question are loaded in the background while the user is looking at whatever question they are on. Pretty simple, it's all figured out in PHP and the database. Unfortunately the images are not being pre-loaded into the browser cache. Or if they are, they aren't being used for the next page. Here's a quick sample of the image loading code:
img1 = new Image();
img2 = new Image();
img1.src = "pics/ano27_image1.jpg";
img2.src = "pics/ano27_image2.jpg";
Has anyone here on the forum done something like this before? Any tips? Maybe I'm going about this all wrong. I've seen other Javascript sites set up to download everything, THEN display the page. It still takes time to do that though, and I think the person the site is for still might not like that approach.
thanks for any help.
-Josh
