[thelist] Preload images

BT Bigpant bigpant at btinternet.com
Tue Feb 5 16:30:01 CST 2002


aaaagh! The dreaded Dreamweaver rollover code. Don't get me wrong, it's
quicker than coding it yourself, but I find it very messy and *very* slow. I
would go for a slimmer, less generic piece of JS. Or stick all the img tags
onto a html page that's in a hidden frame, or that have zero size.

You can use the .complete attribute of an image to test if has loaded, but
this doesn't necessarily help with your problem.

Have you checked your browser settings ? I have awful caching problems with
IE 5.5 on Win98, particularly with Flash movies.

I actually have a similar problem with a web application that uses popup
browser windows for open/close dialogues. The main browser window 'forgets'
the preloaded rollovers after a dialogue window is closed.  ???...

Maybe we'll crack it together...

Phil Parker

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Michael Galvin
Sent: 05 February 2002 20:43
To: thelist at lists.evolt.org
Subject: [thelist] Preload images


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

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list