|
#1
|
|||
|
|||
|
preloading images
Hello there, does anyone know of a simple way to preload images? This should mean that the second image begins loading as soon as the first is done?
I'm useless at code and have spent a while trying to figure this out, but I do feel as though it will help the usability of pixelpost. Any ideas welcome. Cheers, Joe |
|
#2
|
||||
|
||||
|
This is not a bad idea.
I'll throw a quick addon together to grab the image name of the previous image.
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
|
#3
|
||||
|
||||
|
Here it is: Simple Image Pre-loader v0.1
You can use this with whatever javascript pre-loading script you wish. Use the new template tag, <PRELOAD_IMAGE_NAME> to grab the previous image name for pre-loading. Here is a extremely simple javascript pre-loader example: HTML Code:
<script type="text/javascript"> if (document.images) { img1 = new Image(); img1.src = "images/<PRELOAD_IMAGE_NAME>"; } </script> This may be useful if you have the wraparound image addon installed. If you know what you're doing, feel free to modify the addon to your liking.
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
|
#4
|
||||
|
||||
|
It may be a good idea to add this to the bottom of the template, rather than the top.
That way the browser will load the current images first before trying to preload. Also, by adding something like this to the header of your site will cause FireFox to preload when it is idle: HTML Code:
<link href="images/<PRELOAD_IMAGE_NAME>" rel="prefetch" />
__________________
Jay Williams | A Different View Last edited by jaywilliams; 02-20-2007 at 03:34 PM. |
|
#5
|
||||
|
||||
|
Good idea Jay.
You can use the addon to do all of that. All the addon does is fetch the previous image name. Use the tag in anything you want
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
|
#6
|
|||
|
|||
|
Sounds good, but I'm not clear. First do I install the add on, and then do I add the text from Jay (if so, what page do I add it to?)?
Thanks for the help so far, I hope others find it helpful too. |
|
#7
|
||||
|
||||
|
Yes, the addon is necessary to retrieve the image name to be preloaded.
So install the addon and use whatever pre-load script you wish. My example pre-loads the next ("previous") image as the page loads so essentially, you are loading 2 photos instead of 1. This will slow down your page loading times for visitors with slow connections. It should not bother high-speed users though. What Jay is showing you is an alternative method that can be used to load your images in the background after the page has loaded. This is nice but the code he posted above only works with some mozzila based browsers as far as i know.
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
|
#9
|
|||
|
|||
|
Quote:
http://www.pixelpost.org/forum/showt...ghlight=secret ? My secret images seem to load really slowly even after the mouse has moved over the trigger image. If my images have a standard file naming such as image1-before.jpg and image1-after.jpg, is it possible to make it work? Sorry not really familiar to scripting to modify it myself. |
|
#10
|
||||
|
||||
|
I am not familiar with the secret image addon but yes, it can be done.
When I'm not too busy i'll see what I can do.
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
| Post Reply |
| Thread Tools | |
|
|