Submenu positioning [Now, With URL]

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
User avatar
casca
Advanced
Advanced
Posts: 13
Joined: Tue May 02, 2006 7:37 pm

Post by casca »

Ruth wrote:Hi,

In a horizontal menu, the submenus will be below the parent unless you have specified an offset or if it is longer than the screen and you do not have overflow=scroll set and there is room for it to move up.

But in a vertical menu the menu does NOT go below the parent it goes to the side and is set based on the left and top submenuoffset code at the top of the menu data file

subOffsetLeft=; and subOffsetTop= are used to position a vertical submenu that opens from a vertical main menu.

Ruth
OK, but in my case?
You see my example page? Rolled the page it menu to remain in the top? The behavior is strange, because it has sufficiently space for submenu to be mounted correctly below of the parent.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

The problem seems to be setting the menuheight with overflow="scroll"; when the submenu is opening from a vertical menu. As you see in the Samples submenu it works fine, but it's opening from a horizontal menu. For now remove the menuheight and it will open correctly.

I've reported the issue.

Ruth
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I just thought of something else that you can do as a sort of 'work around' It is not perfect and I would really need to know how many items you have in that menu. It doesn't work as it should with the Menu Samples menu because there are so many items in it, however I did get it to work more or less with a submenu with 24 items.

It is not perfect. It still opens up on the page, but it opens in such a way as to look OK, and on the second mouseover it aligns pretty good.

Add this to the top part of the menu data file.

Code: Select all

var sub1TopOffset=203; 
var sub1LeftOffset=3;
It goes right below the _subOffsetLeft=2;

Then copy and paste this as your Anti Spam menu. There are 27 items in it. If you make it only 24 items it works even better.

Code: Select all

with(milonic=new menuname("Anti Spam")){
top="offset=" + sub1TopOffset; 
left="offset=" + sub1LeftOffset; 
style=menuStyle;
overflow="scroll";
menuheight=250;
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
aI("text=Spam Cop;url=http://www.spamcop.net/;");
aI("text=Mime Defang;url=http://www.mimedefang.org/;");
aI("text=Spam Assassin;url=http://www.spamassassin.org/;");
}
What will happen is that it opens towards the top but not right at the top. It's still reading the space needed for the whole menu with the overflow="scroll"; and not getting to the menuheight part until after it renders the first time, but it is down from the top a good ways and kind of looks as if the bottom of that submenu is trying to match up with the bottom of the one that opened it. On the second mouseover the top will be just about even with the top of the submenu in which the link to open it is.

It is only a workaround while Milonic sees if there is anything that can be done to get it to open just as if it were a regular submenu with no overflow="scroll"; in it. I thought it might help if you need the menu up right away.

Those variables were set up so that people who needed to have a different offset for a set of 1st level submenus than the offset coded in the menu data file could do that.

Ruth
Post Reply