T O P I C R E V I E W |
Commsman |
Posted - 18 Apr 2005 : 09:42:29 Hi What is the easiest way to pre-load images which are going to be called by events in the page? The images are not to be shown until the events are triggered, but I don't want the visitor to my site to wait while the image is downloaded - it should already have been loaded using for example script called from a body onload parameter (the same way Dreamweaver handles it for example): Dreamweaver usually does something like: <body onLoad="MM_preloadImages('image1.gif','image2.jpg','image3.gif')">
and the JavaScript used is:
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];}} }
Is there an easy way to do this in Dynamic HTML Editor or do I have to do it by hand? I would then embed this script in the page (although it would be better as an external file if many pages were going to use the function) and try to remember what the image names are going to be for each page. Or could this be a system which could be done automatically by Dynamic HTML Editor?
Chers Julian |
2 L A T E S T R E P L I E S (Newest First) |
Commsman |
Posted - 19 Apr 2005 : 10:39:43 Great - sorry I did not spot the code to do this I have registered now - this is excellent software. Regards Julian
|
s.dav |
Posted - 18 Apr 2005 : 11:48:13 Dynamic HTML Editor already preload hidden images (those used by events and rollover)! Set for example a rollover effect over an image and try to view the page source! |
|
|