Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:55

popup submenu on Load


Poster: aaronz
Dated: Thursday January 27 2005 - 19:24:55 GMT

I am attempting to get a certain submenu to be open by default when a page loads. However, calls to both menuDisplay and popup do not work. In fact, I am able to get the numeric menu ID by name using getMenuByName, but when I pass the same name to gmobj, it returns null. Am I missing something? Thanks.

Aaron


Poster: Ruth
Dated: Thursday January 27 2005 - 21:01:15 GMT

Hi Aaron,
There was a function written to open subs automatically onload. Perhaps that will help. AutoOpenSubsOnLoad

Ruth


Poster: kevin3442
Dated: Thursday January 27 2005 - 23:03:38 GMT

Hi Aaron,

Working on the next phase, eh... getting the menu that was open on the previous page to open again on the next page? Just out of curiousity, are you passing the _itemRef from one page to the next as a url parameter?

aaronz wrote:
I am attempting to get a certain submenu to be open by default when a page loads. However, calls to both menuDisplay and popup do not work.

I seem to recall that there was a recent bug fix in v5.7 that may be affecting you (the bug, that is, noyt the fix). According to the version info page:
version infor for 5.7 wrote:
Fixed bug with popup menus not displaying when alwaysvisible was declared as zero

I would imagine that this same bug could be affecting the menuDisplay() function as well. If I recall our previous work together, your submenus are set to alwaysvisible=0, and then the custom function we made sets alwaysvisible=1 to achieve the desired result. But when you go to the next page and the .js files are reloaded, alwaysvisible=0 again for your submenus. So, if you have v5.691(or earlier) the bug would give you a problem using popup() to open the submenu. v5.7 is in a pre-release stage right now, but I believe it will be released soon. I've been using it on our staging server with no ill effects. Try downloading the pre-release and see if that fixes the popup() issue for you. Alternatively, you could do what we did before and set the menu's alwaysvisible property to 1 before calling menuDisplay() or popup(). Finally, I've run into situations before where if you try to open a menu too quickly after the page loads, then the function doesn't work. In those situations, I've used setTimeout() to introduce a brief delay (100 or 200 msec) before attempting to open the menu; that usually works.

So... a few alternatives to try.

aaronz wrote:
In fact, I am able to get the numeric menu ID by name using getMenuByName, but when I pass the same name to gmobj, it returns null. Am I missing somethin?

I'm guessing that you're using gmobj() in conjunction with menuDisplay()... right? Using the internal menu methods can be tricky at first. If you want to post the code you're using, I'll have a look.

Cheers,

Kevin


Poster: aaronz
Dated: Friday January 28 2005 - 19:45:46 GMT

Quote:
There was a function written to open subs automatically onload. Perhaps that will help. AutoOpenSubsOnLoad


This did help somewhat, thanks!

Quote:
I've used setTimeout() to introduce a brief delay (100 or 200 msec) before attempting to open the menu; that usually works.


This did the trick after I implemented a modified version of the above function. However, my biggest question is whether the required delay is going to vary based on the technical specification of the client's machine. Is this something I should be concerned about?

Thanks to both of you!

Aaron


Poster: kevin3442
Dated: Friday January 28 2005 - 22:09:27 GMT

aaronz wrote:
[However, my biggest question is whether the required delay is going to vary based on the technical specification of the client's machine. Is this something I should be concerned about?

If you're relying heavily on the delay, then yes, you should be concerned; I'm sure you're thinking that slower connections will still yield the same problem you had before.

Did you try version 5.7? I just happend to be doing something similar on our staging site right now (popup a particular menu as soon as the page loads). I had some problems until I switched to 5.7.

Are you setting the menu's alwaysvisible property to 1 before calling popup()?

Are you using popup() or have you tried menuDisplay() again? (I sometimes have better results with that, depending on what I'm trying to do).

When you say that the function calls don't work, what error message are you getting (object doesn't exist?). If it's a non-existent object error, can you determine whether it's the function or the menu that doesn't exist when you need it?

If you want to post a url to your test page, I could have a look and maybe make some specific suggestions. (Same url as before?)

Cheers,

Kevin


Poster: aaronz
Dated: Thursday February 3 2005 - 14:54:39 GMT

Quote:
Did you try version 5.7? I just happend to be doing something similar on our staging site right now (popup a particular menu as soon as the page loads). I had some problems until I switched to 5.7.


Yep... I'm using 5.7 for all of this. Didn't seem to make a difference when I switched to it..

Quote:
Are you setting the menu's alwaysvisible property to 1 before calling popup()?


Yes, although I am using menuDisplay(), not popUp()... I haven't been able to popUp to work under any circumstances.

Quote:
When you say that the function calls don't work, what error message are you getting (object doesn't exist?). If it's a non-existent object error, can you determine whether it's the function or the menu that doesn't exist when you need it?


Yes, there's no error message, actually. The menu does exist, for I've been able to return a reference to it using gmobj() with an alert command... so, my assumption is that the function doesn't exist. Why that doesn't result in an error message, however, is beyond me.

Quote:
If you want to post a url to your test page, I could have a look and maybe make some specific suggestions. (Same url as before?)


http://www.input.com/_milonic

...Also, my employers are also now requesting that I apply a tabbed-look to the menu, which is going to prove difficult without being able to dynamically change the source image of separator graphics... I'll probably have to start a new topic for this, but if you've got any ideas for that, I'm all ears :)


Poster: John
Dated: Thursday February 3 2005 - 18:50:24 GMT

Note that the actual release version of 5.7 was just posted. You might try another download.


Poster: krog
Dated: Thursday May 12 2005 - 20:18:10 BST

Hi,

I'm having the same problem Aaron was experiencing. I am trying to get a specific submenu to display automatically when a page loads, but calls to menuDisplay() and popup() do not work. I am able to get the numeric menu ID by name using getMenuByName, but when I pass the same name to gmobj, it returns null for all of my submenus but one. I can't see any difference in the way I defined the submenu for which gmobj returns an object.

I tried calling the AutoOpenSubsOnLoad() function mentioned earlier in the thread, but got a JavaScript error. I couldn't find any documentation on this function, and the link to the function in this thread does not seem to be working. At any rate, I am not sure this function would be a solution, unless it allows me to specify which submenu to open on page load.

Thanks in advance,
Krog


Poster: HCBen
Dated: Friday May 13 2005 - 18:06:36 BST

I too am in need of the ability to re-display a specific menu when the page loads.

I've been playing around with the Automatic Menu Opening Module openmenusbyurl.js version 1.3 (http://www.milonic.com/openmenusbyurl.js); however since upgrading to version 1.3, I can no longer "cheat" the script as I described in this thread: http://www.milonic.com/forum/viewtopic.php?t=5913

I use two different Milonic menus on my dev site (http://dev.hanover.edu/) but I only need the second menu to work with the module. Is there any way to accomplish this?

Thanks,
Ben


Poster: krog
Dated: Friday May 13 2005 - 18:29:43 BST

HCBen,

Try upgrading to version 1.4 of the Automatic Menu Opening Module at http://www.milonic.com/openmenusbyurl.js available as of today. It has a new parameter called called "forceChildSubOpen" which seems to do the trick quite nicely! (I've tried it and it does display the appropriate submenus automatically.)

Krog


Poster: HCBen
Dated: Friday May 13 2005 - 18:43:28 BST

Thanks Krog,

I'm using that version now, however I still need to find a way to open only one of the two menus - not both.

Ben


Poster: krog
Dated: Friday May 13 2005 - 19:01:02 BST

I am having the same problem, or very similar: The new forceChildSubOpen property seems to be ignoring mm_maxLevels. Too many levels of the menu open up.