[thelist] Preload images
Robert Goodyear
rob_goodyear at yahoo.com
Tue Feb 5 17:38:00 CST 2002
This works really well for me. Props to Jeff for clean
code.
http://members.evolt.org/jeff/code/preload_n_rollover/index.cfm
> I'm using a JS function to preload certain images
> (rollovers, mainly) on my
> page. AFAIK, it's working correctly - I have no real way
> of proving it.
> However, I've noticed that even when I preload, IE looks
> to be still
> attempting to load the image from the server, the
> progress bar appears
> briefly. The strange thing is that it happens every
> time, even after I
> brought up the rollover image once, move away (so it
> defaults back) and then
> go over it again -- the progress bar appears again. The
> rollover images are
> small, ~2k, so I would expect the loading time to be
> quite quick.
>
> Would I be right in assuming that my preloading isn't
> actually working if
> this is the case? What would be the reason for the
> repeated loading after
> the rollover has been loaded once? Is this normal? We
> have an ISDN in
> work, so I'm a little concerned that on a dialup, the
> user will be sitting
> there for a few seconds (or more) while the rollover
> image is loaded.
>
> JS:
>
> function MM_preloadImages() { //v3.0
> var d=document;
> if(d.images){
> if(!d.MM_p) d.MM_p=new Array();
> var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
> for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){
> d.MM_p[j]=new Image;
> d.MM_p[j++].src=a[i];
> }
> }
> }
>
> which is then run Body onLoad
> MM_preloadImages('name',....). I inherited
> the code from the previous developer -- I've never
> bothered with rollovers
> before, didn't see the point in them. :D
>
> Michael
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
More information about the thelist
mailing list