Initial delay in displaying background image

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
nige_w
Beginner
Beginner
Posts: 4
Joined: Sun Dec 19, 2004 9:56 pm
Location: Christchurch, New Zealand

Initial delay in displaying background image

Post by nige_w »

We (http://www.acclispeweb.co.nz) are new users of the Milonic Navigation for websites we create. All the designers here love it !

We have recently created a new site (http://www.avoninvestments.co.nz) using a background image for the navigation.

We have noticed that there is a slight delay in displaying the over background image when first mousing over the navigation items.

We attempted re-loading the image to see if this would correct the problem, however this has not helped.

Can you advise if there is something we are doing wrong / could be doing better when using background images for the navigation.

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

Post by Ruth »

There is a preloadmenuimages.js module that might help. It's the 'over' images loading. I watched the status bar and they are there if you wait for the images to load. But if you mouseover right away then the image isn't load yet and that's causing the problem.

I don't know if this would make a difference but there is also a buildAllMenusproperty. It's down a few items. I don't know if that would help here since you don't have any submenus.

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Initial delay in displaying background image

Post by kevin3442 »

Hi,
nige_w wrote:We have noticed that there is a slight delay in displaying the over background image when first mousing over the navigation items.
It's probably the time it takes to download the background image the first time it is used (so it isn't in the browser's cache yet). You don't notice a delay after that because the image is now loaded from the cache. Two suggestions:

(1) Normally, to cut down on processing time when the page loads, a menu isn't "built" until it is first opened. You can cause the system to build all menus when the page loads by placing buildAllMenus = true; at the top of your menu_data.js file, with the other global variables (where you see _menuCloseDelay=500 etc.). Honestly, it's been a while since I've used that, but I'm thinking that it may load the images while it's building the menus. If that's the case, then the image should already be in the cache the first time it's needed.

If that doesn't work:

(2) well... I just did a search for preloadmenuimages.js to find a link to a topic mentioning it, and the top of the results page showed this thread! "Now how could that be???" I thought. Turns out it's because Ruth posted a reply while I was typing this one. A day late and a dollar short... again.

If you try the preloader, make sure you load the preloadmenuimages.js file after your menu_data.js file.

Cheers,

Kevin
nige_w
Beginner
Beginner
Posts: 4
Joined: Sun Dec 19, 2004 9:56 pm
Location: Christchurch, New Zealand

Post by nige_w »

Hi Ruth and Kevin

Thanks for your replies - I will investigate when I'm back at work next week.

I did notice a typo in my first post - I meant to say that we are preloading the over state image - my post said we were re-loading - oops.

Thanks againf ro your help.

Regards

Nigel
nige_w
Beginner
Beginner
Posts: 4
Joined: Sun Dec 19, 2004 9:56 pm
Location: Christchurch, New Zealand

Post by nige_w »

I've just re-read my comments and realise my typing skills haven't been to flash !!!

In any case I have tried the following with no success :

1. Manually inserting JavaScript to preload the overbgimage.
2. Using the preloadmenuimages.js file to preload the image.
3. Using the buildAllMenus = true; variable.

We have a MySQL database driven content management system so we do not use the "menu_data.js" file - this is all built dynamically as the page loads. We have however factored in the ability to add the "buildAllMenus = true;" variable.

The weird thing is that another site we have created also uses background images for the nav and there is absolutely no delay in loading the over state. This site does have a simple JavaScript preloader loaded within the site.

The exmaple sites are

1 - http://www.avoninvestments.co.nz - delay in rollover image
2 - http://www.acclipse.co.nz/demos/business/bmaster - no delay
nige_w
Beginner
Beginner
Posts: 4
Joined: Sun Dec 19, 2004 9:56 pm
Location: Christchurch, New Zealand

Post by nige_w »

OK folks - false alarm - ignore the idiot from down under . . .

I have reinserted the JavaScript code to preload the image (this is hand coded as opposed to the Milonic preloader) and everything is now working fine.

Sorry for the disturbance, but thanks for your input.

Nigel
Post Reply