PDA

View Full Version : 2 javascripts conflicting



J_S
07-19-2007, 01:48 PM
I'm using a navbar javascript which initialises on 'window.onload'. It's one of those drop-down style menus which appear on hover.

Also on the page I'm using a slideshow javascript. This script preloads the images used in the slideshow.

Unfortunately what's happening is as the page loads, navbar's dropdown menus all show, as the slideshow takes a few seconds to load its images. Only once these slideshow images are loaded is the window completely loaded, after which the navbar javascript runs. It's not until this javascript runs that the navbar's dropdown menus hide until they are rolled over.

The result is my page looks like a mess for a few seconds until the navbar menus disappear. How can i fix this?1

J_S
07-19-2007, 01:54 PM
i've fixed this myself. in my navbar.js script i simply replaced "window.onload = mladdevents;" with "mladdevents();" and placed the "<script language="JavaScript" src="js/navbar.js"></script>" line after my navbar html, to be sure that navbar.js only gets initialised AFTER the navbar html has loaded.