|
Build a website with javascript games and other dynamic content
Step Five - preload image
To load an image even when it is not displayed can be done with something simliar
to the next script
<script>
if (document.images)
{
a = new Image(52, 53)
a.src = "pix/2.gif"
b = new Image(52, 53)
b.src = "pix/2on.gif"
}
<script>
This is how in the page before the images where loaded in to the cache
even when they were not displayed yet. This methode ensures smoother changes after
the page is loaded completly, because the image can be retrieve from cache if needed.
Obviously it will take longer to load the page in the beginning.
Next step
|
|