popup submenu on Load

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
aaronz
Advanced
Advanced
Posts: 18
Joined: Tue Jan 18, 2005 5:16 pm

popup submenu on Load

Post by aaronz »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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

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

Post by kevin3442 »

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
aaronz
Advanced
Advanced
Posts: 18
Joined: Tue Jan 18, 2005 5:16 pm

Post by aaronz »

There was a function written to open subs automatically onload. Perhaps that will help. AutoOpenSubsOnLoad
This did help somewhat, thanks!
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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
aaronz
Advanced
Advanced
Posts: 18
Joined: Tue Jan 18, 2005 5:16 pm

Post by aaronz »

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..
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.
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.
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 :)
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Note that the actual release version of 5.7 was just posted. You might try another download.
John
krog
Beginner
Beginner
Posts: 3
Joined: Thu May 12, 2005 8:02 pm

Post by krog »

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
HCBen
Beginner
Beginner
Posts: 9
Joined: Thu May 05, 2005 2:28 pm
Contact:

Post by HCBen »

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://milonic.com/openmenusbyurl.js); however since upgrading to version 1.3, I can no longer "cheat" the script as I described in this thread: 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
krog
Beginner
Beginner
Posts: 3
Joined: Thu May 12, 2005 8:02 pm

Post by krog »

HCBen,

Try upgrading to version 1.4 of the Automatic Menu Opening Module at http://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
HCBen
Beginner
Beginner
Posts: 9
Joined: Thu May 05, 2005 2:28 pm
Contact:

Post by HCBen »

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
krog
Beginner
Beginner
Posts: 3
Joined: Thu May 12, 2005 8:02 pm

Post by krog »

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.
Post Reply