Preload menu image back / sample needed ...

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
BTC
Beginner
Beginner
Posts: 3
Joined: Wed Mar 02, 2005 5:20 pm

Preload menu image back / sample needed ...

Post by BTC »

Hi awhile ago I wrote here and since lost where it went,

However, we have a center justified website and using the menu code at top of page right after /head to call up additional menu files/info.

QA? It was suggested that since menu images (as compressed as they are, be preloaded) using a files we were givin from here called: preloadmenuimages.js

1 - We regret we not 100% sure where or what code (conext) to use.

2 - Within the preloadmenuimages.js file, how (context) do we preload the image(s) ..

Actual sample needed.

- THANKS : Michael (http://www.JungleHouse.com)
---------------------------------------------------------
FYI, here is our supporting for each:

#1: [[ DO WE ADD line to call preload.js within here? ]]

<!-- ==MENU== -->
<SCRIPT language=JavaScript src="menusrc.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=menuprog.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=menudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="menu.js" type=text/javascript></SCRIPT>
<!-- ==MENU== -->


#2: [[ The preload.js text / what would a line to preload image look like? ]]
/*
Milonic DHTML Menu Image Pre-loading Module preloadmenuimages.js version 1.0
This module is only compatible with the Milonic DHTML Menu version 5.16 or higher

Copyright 2004 (c) Milonic Solutions Limited. All Rights Reserved.
This is a commercial software product, please visit http://milonic.com/ for more information.

USE: This module does not need any parameters but needs to be placed after the menus have been built

SYNTAX: <script language="JavaScript1.2" type="text/javascript" src="preloadmenuimages.js"></script>
*/

_mIms=new Array();

function _mPLF(_img)
{
for(_x=0;_x<_mIms.length;_x++)
{
if(_img==_mIms[_x])return
_x++
}

_mIms[_mIms.length]=_img
_mIms[_mIms.length]=new Image()
_mIms[_mIms.length-1].src=_img
}


function mmenuPreLoadImages()
{
for(_i=0;_i<_mi.length;_i++)
{
_I=_mi[_i]

if(_I[24])_mPLF(_I[24])
if(_I[29])_mPLF(_I[29])
if(_I[32])_mPLF(_I[32])
if(_I[46])_mPLF(_I[46])
if(_I[47])_mPLF(_I[47])
if(_I[48])_mPLF(_I[48])
if(_I[56])_mPLF(_I[56])
if(_I[69])_mPLF(_I[69])
if(_I[71])_mPLF(_I[71])
if(_I[73])_mPLF(_I[73])
}
}

mmenuPreLoadImages()
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

It gets loaded after the menu_data.js file

Code: Select all

<SCRIPT language=JavaScript src="menusrc.js" type=text/javascript></SCRIPT> 
<script language=JavaScript> 
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=menuprog.js><\/scr"+"ipt>"); 
else _d.write("<scr"+"ipt language=JavaScript src=menudom.js><\/scr"+"ipt>"); 
</script> 
<SCRIPT language=JavaScript src="menu.js" type=text/javascript></SCRIPT> 
<SCRIPT language=JavaScript src="preloadmenuimages.js" type=text/javascript></SCRIPT> 

You don't need to put anything into the module if that's what you are asking. You just have to make sure it is called after the menu_data.js file is called. The preloadmenuimages.js file works with the program, it reads the images from that.

Ruth
Post Reply