View Full Version : Setting load order for page items

06-11-2004, 10:30 PM
I have been told there is a way to make different page elements(e.g. <div> elements) load in a certain order, im asking because i have a website with 3 <div> elements and a .swf menu, but the menu always loads last, how would i stop everything else from loading until the menu is loaded?

Roy Sinclair
06-11-2004, 11:28 PM
The "load order" is detemined by the order in which they are delcared on the page AND by the order in which the server provides them. Larger files will also obviously take longer to arrive at the client than smaller files.

There's no surefire way to control this except to build all the contents into the original file.

06-11-2004, 11:53 PM
What do you mean by 'build all the contents into the original file.'??

David, 14

Roy Sinclair
06-14-2004, 05:45 PM
Have you ever noticed that some spam messages have images in them even though you may not have an active internet connection when you view the message?

That's because the image data is part of the file that's sent to the user and not sent as a link to an external source. That same capability is available for ordinary html, it's not something special added just for the benefit of spammers. The key is that it isn't real simple to use so it's mostly spammers who are using it.

From your description it appears to me that your problem though seems to be in getting a menu to be usable before the rest of the page loads. I'm going to assume that means you've got a javascript based menu and a number of images as well and your menu isn't available until the images have finished loading AND the images take long enough to load that you users get impatient for the page to come available. Please advise if my analysis of the problem in incorrect or incomplete.

Probably the first thing you might want to look for may be in the menu code itself, many javascript menus use the "onload" clause to initialize themselves so they explicitly wait until everything else on the page has finished loading before they'll perform whatever magic they need to do in order to work. Sometimes you can simply bypass the onload and have the menu work earlier but there are many menus out there which definitely need to have the page loaded first. Menus which use images almost always fall into that category.

Another thing you can check is to make sure your images are "optimized" for web viewing so they'll load as quick as possible. I can recall visiting a page which had a large number of thumbnail images on it but every single one of those thumbnail images was a fullsize image which took a very long time to load. Make sure your images are exactly the same height and width as specified in the image tag which calls them so they aren't oversized. If you need thumbnail size views, make sure you create separate thumbnail size images for those views.