Forum Moderators: open

Message Too Old, No Replies

dw image preloader .. edit

dreamweaver preload images

         

MALditoNica

8:58 am on Oct 20, 2003 (gmt 0)

10+ Year Member



hi everybody

let me say right from the start .. I´m not a coder ... "just" a designer!
that said .. here is my question:

I´m using dreamweaver´s built in preloader for a menu. it looks like this:

---------
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];}}
---------

Then, in the body tag you have the preload:

---------
<body onload="MM_preloadimages('/images/image1.jpg','/images/image2.jpg')">
---------

But I don´t want the function calls to be in the file itself, BUT linked to
an extenal js file.

can you PLEASE tell me how to do it? (using this confusing dw
code

zoobie

12:44 am on Oct 21, 2003 (gmt 0)

10+ Year Member



Dunno 'bout dat...but if you just want to preload a few images, just stick this on your page somewhere:
<div style="display:none">
<img src="pic1.gif">
<img src="pic2.jpg">
<img src="pic3.png">
</div>

Preloading anything takes time of course. You may be better off just quickly downloading the image once your users clickity click. Depends...

korkus2000

2:34 am on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the board MALditoNica,

Calls must be made during an event. Usually on the page. You could call it off another function, but that would still need to fire off from an event. You could use the onload method but event methods are very buggy across browsers. Why do you need to move it off page?

MALditoNica

7:30 am on Oct 21, 2003 (gmt 0)

10+ Year Member



actually some allready pointed me to the right direction. It was fairly simple:

Put the js code in an external file, and right after it .. in the same file ... function call (previously was the onload)

done!

why?
in case i need to change my menu, i dont have to change every single page ..