View Full Version : body onload init()

12-15-2005, 12:29 PM
I have menu 5.7 and use it center on my site

my problem is, that the menu dos not load until all other things have been loaded. Is it possible to change that, I want it to be the first thing that loads.
I have tryed to put <script type="text/javascript">init();</script> into my tabel, that dos not work.

this works, but then the menu is not center anymore
<script type="text/javascript">init();</script>

pleaseeeeeeeeeeeeeee help me

Dennis Overskov

12-27-2005, 03:13 AM
I am having the same problem, except I'm using the HV menu...
Is there any way to make the menu load BEFORE everything else on the page? On some of my pages, there are a lot of images, which causes the page to be slow-loading and i'd like for people to be able to navigate off the page w/o having to wait until every picture is loaded....

Can someone please help me? There's probably an easy solution to this, but please help!!! It'd be greatly appreiciated!

12-27-2005, 04:13 AM
There is one major problem with this idea. Both of these menus initialize their positions after the rest of the page is loaded for a reason, so they can tell where the center or wherever it is that they are supposed to be is before placing themselves there. It is entirely possible that one may be able to find a point in the page load prior to its completion where this information may be available but, generally this can vary on each page load, so extensive testing would be required to determine the appropriate spot and to see if this holds up in different browsers under different conditions (like both fast and slow connections, etc.). This is why they are designed to do this onload, as it is the safest time to do so.

Things you can do are:

Optimize all of your images so that they take less time to load and perhaps even preload images while your visitor is preoccupied with a splash or welcome page.

Cut down on images, too many will obscure or otherwise detract from the real content of your page anyway.

Eliminate tables, especially nested tables, as these also are a drag on load time.

Set dimensions (the height and width attributes, not style) for all images and if your images are not already those sizes, physically resize them (in a paint or image program) to match.

The less the browser has to do, the faster the page will load. If you have other onload events, make sure they fire after the menu's.

12-27-2005, 04:55 AM
Well, for my menu, i'm positioning it using a table, so I'm placing the div for MenuPos inside of a table. I don't know if that makes a difference considering the positioning and such...Then, I have all my pictures inside a different cell of the table.

One reason I can't really reduce the pictures is because I'm using it as an image gallery, and I already have them as small thumbnails.

Is there any possible way I can solve this problem by just making the menu load without having to wait for each thumbnail to finish loading?

12-27-2005, 05:24 AM
If this is a gallery, I would hope that it is not also the main or index page for your site, if it isn't, in addition to optimizing the images, resizing them (if applicable) and reducing their number, you can preload the images on all pages that have a link to the gallery.

I do have one page that is an index page for a site that I master that is also a gallery but, it is a mini gallery with all of the images just teasers for the main gallery and all of the images are therefore small and, of course all optimized.

As I said before but, perhaps wasn't as clear as I could be, there is no easy or reliable way to do what you propose. It could perhaps be done fairly reliably but, only in conjunction with extensive testing. As daunting as it may appear, it would be far easier to take all of the steps I outlined in my previous post on this matter that apply to your page and implement them.