|
home / documentation / setup / preloading images during page load instead of after
Preloading Images During Page Load Instead Of After
By default, HierMenus will preload its standard images (the more images indicating that
a child menu exists for a menu item, or that more choices are available above or below
the scrollbar in scrolling menus) just after the HTML page finishes loading, but just
before the menus are actually created (dependent on the menu's
CreateOnLoad setting, of course).
In addition to these standard images, HierMenus will preload at that same time any
rollover images that you've designated in the
HM_o_RolloverImages object. You can disable
this image preload routine by setting the
PreloadImages parameter to
false in an HM_f_UpdateDefaults call.
In some cases, however, waiting for the page to complete loading to process your image
preloads will be too long for your needs. If you would rather have HierMenus preload the
standard and rollover images while the page is loading, you can place this command
in your configuration file:
if(typeof(HM_f_PreloadImages)!="undefined")
HM_f_PreloadImages();
This command will process HierMenus' image preload routine immediately, and since the
configuration file is processed as part of the page load, the image preloads will happen
as part of the page load, too. When you call HM_f_PreloadImages directly in
this manner, you will override HierMenus' own image preloading. In other words, whether
you've set the PreloadImages parameter to true or false, HierMenus will
"see" that you have already processed the image preload manually and will not reprocess
the routine on its own.
Note that HierMenus' preload routine uses the image locations as they were specified
in HM_f_UpdateDefaults; therefore you should specify the locations of your
more images as default settings whenever possible. If specified on the menu or item
level only, HierMenus may miss the preloading of these images. If you must specify
more images on the menu or item level (perhaps as overrides) and you're having trouble
with their display as the result of not having been preloaded, you can always force them
to preload by including them explicitely in a HM_o_RolloverImages object
in the configuration file. Just set them to "fake" ids (HM doesn't actually care if the
ids presented in HM_o_RolloverImages actually exist on the page; it attempts
to preload the designated image for them anyways).
|