Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:19
Preloading Images
Poster: kevin3442
Dated: Friday July 16 2004 - 21:23:59 BST
Hi All,
I've seen the file, preloadmenuimages.js, mentioned in a few threads recently, where the virtues of preloading your menu images have been discussed. But there really aren't any clear-cut instructions for how to use this file. So, I thought I'd provide some, for those who come looking...
(1) Download preloadmenuimages.js from Milonic, then put it on your web server. It probably makes most sense to put the file in the same location as your menu_data.js file (or whatever you call yours).
(2) Load preloadmenuimages.js into your page at some location after your menus have been defined (i.e., after all the aI() stuff), so that the preload function knows what images it needs to get. For most, that means load preloadmenuimages.js after you load menu_data.js, like this:
Code:
<script language=Javascript src="menu_data.js" type=text/javascript></script>
<script language=Javascript src="preloadmenuimages.js" type=text/javascript></script>
<script language=Javascript src="preloadmenuimages.js" type=text/javascript></script>
For those who do variations with tables, etc, and move some of the code around, as long as the menus have been defined first, the preload will work, even if the menus have not yet been displayed with drawMenus()
Hope that helps,
Kevin
Keywords:
preload preloading precache images
Poster: markbinau
Dated: Wednesday September 22 2004 - 14:46:13 BST
Thanks for the info about preloading the images it is very helpful. I noticed in your suggested lines of code that you said
Quote:
<script language=Javascript src="preloadmenuimages.js" type=text/javascript></script>
In the preloadmenuimages.js file it suggests
Quote:
<script language="JavaScript1.2" type="text/javascript" src="preloadmenuimages.js"></script>
I am new to JavaScript as will be obvious from this question. What is the difference between language=JavaScript and language=JavaScript1.2?
Is there code in the preloadmenuimages.js that requires 1.2?
What happens if a user's browser does not have 1.2?
Is there a way to determine what version a browser supports?
Is there someplace that lists the version supported by common browsers?
Thanks