Click to skip over navigation
 

lecture 8: preloading

<< previous slide

return to lesson 8 index

next slide >>


There is one use of a full JavaScript which is not gimmicky at all - in fact it's very useful. It takes us back to the topic with which we began this lecture - image rollovers. One disadvantage of the rollover is that the new image does not start loading until the rollover begins. With broadband (unless the image is large) this does not usually matter, but remember that, considered globally, most of the world does not yet have broadband. The result can be an unsightly delay between placing the mouse over the image, and the new image appearing.

JavaScript can be used to load the image into the cache before it is needed. Full details are on the page in the online teaching materials about preloading; the scripts are on your handout. If you want to view the source code of this page you can see them in place - they work together to create the rollover on the image of Jupiter above.

It can be difficult to persuade university students of the usefulness of this technique because the university's connections are even faster than an average home broadband connection (particularly if you are looking at pages or images which are already stored here anyway). The delay between starting the rollover and completion can therefore be negligible, even for large images. If you write a rollover, do try and look at it on a slow, dialup Internet connection before you publish it, and this should suggest to you whether preloading is required. (In fact, if you can, look at every page on your site on a slow connection, just to check how long it all takes to come up.)




<< previous slide

return to lesson 8 index

next slide >>