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:47
Can Followscroll=1 work with menu inside a table cell?
Poster: lpotter
Dated: Monday April 18 2005 - 17:48:41 BST
I've downloaded the sample for putting the menu inside a table cell and it works as expected.
I tried adding followscroll=1 to the code, but the menu will not scroll inside the table cell.
Can this be made to work?
I'm trying to put the vertical menu inside the left cell of a two cell table and have it scroll inside the cell as the user scrolls up and down the page (content is inside right table cell.
Or is there a better way to do this other than the way I'm trying?
I find that if I set the cell width of the menu cell to something very small, it still goes to the exact width needed for the menu, this is a good thing to me, meaning that no matter what resolution the user has, I can make the menu cell the exact width required and the content cell gets whatever is left.
Poster: Ruth
Dated: Monday April 18 2005 - 20:51:46 BST
Hi,
When placed in a table cell the menu is fixed in position so followscroll will not work. But, there is a way you could do what you want. There may be a simpler way, but this is the way I figured out to do what you want, but only if the table is 100% width and NOT centered.
For explanation purposes, assume a page with a table you describe with white as the background color.
1. create a new style in your menu_data.js file
Code:
with(tableSTyle=new mm_style()){
bordercolor="#ffffff";
borderstyle="solid";
borderwidth=0;
fontfamily="Verdana, Tahoma, Arial";
fontsize="100%";
fontstyle="normal";
offbgcolor="#ffffff";
offcolor="#ffffff";
onbgcolor="#ffffff";
oncolor="#ffffff";
headerbgcolor="#ffffff";
headercolor="#ffffff";
padding=4;
}
change that to be whatever colors you need, what fonts you have listed in your menuStyle that you're using on the main menu now.bordercolor="#ffffff";
borderstyle="solid";
borderwidth=0;
fontfamily="Verdana, Tahoma, Arial";
fontsize="100%";
fontstyle="normal";
offbgcolor="#ffffff";
offcolor="#ffffff";
onbgcolor="#ffffff";
oncolor="#ffffff";
headerbgcolor="#ffffff";
headercolor="#ffffff";
padding=4;
}
2. create a new menu with only 1 item in it, that item should be the same size as the longest item you have in the main menu. Set the menu to always visible and position relative like the one below.
Code:
with(milonic=new menuname("tablespacer")){
alwaysvisible=1;
style=tableStyle;
position="relative";
aI("text=My Milonic;type=header;");
}
alwaysvisible=1;
style=tableStyle;
position="relative";
aI("text=My Milonic;type=header;");
}
That is the menu you put into the table cell inside script tags and with a drawmenus, just like the one you have now. Since it has the widest text item same as the main menu, it will do exactly what the main menu did with the various resolutions.
Now place the main menu using the top= and left= positions and followscroll=1; The tablespacer menu which you put into the table will keep the table cell the width you want based on resolution and font size of the visitor, and the main menu which is now placed with the top and left positions since it uses the same fonts and sizes will sit over that table cell. Since you have the bgcolors and font colors set to the same as the table background the one you put into the table won't show, and having set it as type=header it won't have the mouse changing for a link.
As I said there may be some easier way, bu this is the one that came to mind.
Ruth
Poster: lpotter
Dated: Monday April 18 2005 - 22:45:08 BST
Ruth, thanks so much for taking the time to help me with my question, and you've got a neat idea too.
It works! However I am having trouble removing the border from my tablespacer menu item. I've got all the other attributes set to the same color as the background, but I still see the menu border.
I tried bordercolor=SILVER but it's not right, because the bordercolor is still as set in the Style section, I can't override it here for some reason, but the text color and back ground color all override just fine.
Any ideas?
Poster: Ruth
Dated: Monday April 18 2005 - 23:30:10 BST
It is a neat little trick, isn't it ?
Have you put the bordercolor in the menu_data file? In the tableStyle section, or whatever you called it? And, you need to set the borderwidth to 0. I did put the bordercolor the same as all other colors, but I also set the borderwidth to 0. With it set that way there shouldn't be any border. Could you post a test page with the menu, the table and any style sheet? There may be a conflict in the css style sheet that is somehow getting picked up by the menu. I wouldn't know why, but.....?
Ruth
Poster: lpotter
Dated: Tuesday April 19 2005 - 0:27:52 BST
I had to make a seperate menu style for the tablespacer hidden menu with all the same properties as the main style to make the border hidden. It works neat. Thanks.
Poster: Ruth
Dated: Tuesday April 19 2005 - 2:11:22 BST
Hi,
Yes, you have to make a separate style for the hidden menu, but it shouldn't have to have the same parameters as the other style. There is something wrong if that is the case. Can you post your two styles, and the table coding for the relative [tablespacer] menu, or a page with the menu so I can see what's happening. The whole purpose of being able to make and assign different styles to different menus is to be able to have the different styles apply to whichever menus/submenus one wishes.
Ruth
Poster: lpotter
Dated: Tuesday April 19 2005 - 18:36:15 BST
The styles for the visible menu and for the tablespacer menu need to have the same parameters (other than coloring) so that the font size and type are the same so the tablespacer hidden menu is sized exactly the same as the longest line in the visible menu.
I do have one other problem though, sometimes the text in a menu has the first letter bolded and larger than the rest of the text.
I can't seem to figure out what causes this (and how to get rid of it).
Currently the first letter of the text in my table spacer menu is Bolded and it does show. like it's text color is BLACK and does not follow the normal text color attribute.
Any ideas? I've seen this before and then it went away, but I have no idea what I did to disable this feature.
Thanks.
Poster: Ruth
Dated: Tuesday April 19 2005 - 21:21:52 BST
Hi,
That would be pretty near impossible to figure without a page to see all the coding, page code, css code, menu code. It could be a number of things, something in the menu style coding, something in some javascript on the page, something in css on the page. Some combination, like having css for a div and putting the menu in a div which is a no-no, or in a table and some coding for the table and so on.
Ruth