JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto height resize when text wraps

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu
Author Message
Paul Philpot



Joined: 09 May 2007
Posts: 6

PostPosted: Thu May 10, 2007 6:23 pm    Post subject: Auto height resize when text wraps Reply with quote

Hi

I have a small issue with text wrap on the menu - I have this menu on a CMS which dynamically writes the new javascript files if there are any changes to the navigation.

When a longer link name is entered (the menu text) , it wraps correctly inside the 'box', but the area is not expanded vertiaclly to accomodate the extra line of text.

Basically I need to know how to set it up so that if there's text wrap to expand teh height of that menu item by a factor of 2...

Any ideas?

Thanks in advance
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Fri May 11, 2007 10:13 am    Post subject: Reply with quote

Autosizing is supported by Professional edition since 2.6.x, and you can find corresponding sample in you "COOLjsMenu Professional 2.N.N.zip" package. Among other things, that sample demonstrates menu items that accommodate their heights to contents' actual height (i.e. width is constant).
Back to top
Paul Philpot



Joined: 09 May 2007
Posts: 6

PostPosted: Tue May 15, 2007 2:16 pm    Post subject: Reply with quote

Thanks for that Alex - my archive must have unpacked weirdly as some of the demo links didn't work. Anyway, I have seen the demo, and all works well in Firefox, Safari and Opera. BUT NOT Internet Explorer 6 on PC.

Weird. I have used the 'size:[ '+self', 145 ]' to allow the menu height to be variable depending on wrapped content, but in I.E. it just places each menu item on top of each other (it's a vertical menu). If I reset the size definition to size:[ 20, 145 ] then all menu items are visible. Also all menu items seem to have the arrow showing in I.E. even where there's no sub menus - the arrows work perfectly in other browsers on the Mac platform.

Just let me know if you need me to send you the code...

Cheers

Paul
Back to top
Paul Philpot



Joined: 09 May 2007
Posts: 6

PostPosted: Tue May 15, 2007 4:13 pm    Post subject: Reply with quote

OK, this is weird.

This is what happens what the vertical menu looks like in Firefox, Safari and Opera on Mac:

Item 1 >
Item 2 >
Item 3 >
Item 4
Item 5
Item 6
Item 7

Then the sub menus appear from items 1-3 correctly (with active link)

On I.E. 6 on windows this is what happens:

Item 1 >
Item 2 >
Item 3 >
Item 4 >
Item 5 >
Item 6 >
Item 7 >

Then the sub menus appear from items 1-3 but with arrows also falsely indicating that there is a 3rd level of menus. And the sub menu links are not active - no pointer icon change, and the sub menu vanishes as if the mouse is out.

This seems to have happened since I either upgraded to 2.9.x or since I changed the code to allow variable menu heights upon text wrapping.

Any ideas?

Here's the code:

Quote:
var color = {"border":"#5d9f39", "shadow":"#c6d8bb", "bgON":"#dcecd2","bgOVER":"#dcecd2"};
var colorItems = {"border":"#bcd7ab", "shadow":"none", "bgON":"#f1fde9","bgOVER":"#f1fde9"};
var css = {"ON":"menu_link", "OVER":"menu_hover"};
var css_items = {"ON":"submenu_link", "OVER":"submenu_hover"};

var STYLE_LEFT =
{
color: color,
size:[ 24, 145 ],
borderWidth:[0,1,0,1],
itemoff:[ '+previousItem-1px', 0 ],
leveloff:[ 0, '+parentItem-1px' ],
css:css
};


var STYLE_SUBMENUS =
{
itemoff:[ '+previousItem-1px', 0 ],
leveloff:[ 0, '+parentItem-1px' ],
borderWidth:[1,1,0,1],
color:colorItems,
css:css_items
};


var MENU_ITEMS_LEFT = [
{pos:'relative', style:STYLE_LEFT, blankImage:'graphics/transparent.gif', arrow:'graphics/arr_forward.gif', oarrow:'graphics/arr_forward_over.gif', arrsize:[7,9] },
{code:"Topics/Themes", url:"index.php?section=4",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
{code:"Innovation", url:"index.php?section=4&subsection=10"},
{code:"Communications", url:"index.php?section=4&subsection=11"},
{code:"Capacity Strengthening", url:"index.php?section=4&subsection=12"},
{code:"Policy and Partnerships", url:"index.php?section=4&subsection=13"},
{code:"Monitoring, Impact and Learning", url:"index.php?section=4&subsection=14"},
]},

{code:"Resources", url:"index.php?section=5",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
{code:"Pictures", url:"/test3/gallery/", "target":"blank"},
{code:"Radio", url:"index.php?section=5&subsection=16"},
{code:"Video", url:"index.php?section=5&subsection=17"},
{code:"Press Releases", url:"index.php?section=5&subsection=18"},
{code:"Reports and Publications", url:"index.php?section=5&subsection=19"},
{code:"Databases", url:"index.php?section=5&subsection=20"},
]},

{code:"Calls", url:"index.php?section=6",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
{code:"Call 1", url:"index.php?section=6&subsection=21"},
{code:"Call 2", url:"index.php?section=6&subsection=22"},
{code:"Archive (past calls)", url:"index.php?section=6&subsection=23"},
]},

{code:"Links", url:"index.php?section=7",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
]},

{code:"News", url:"index.php?section=8",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
]},

{code:"Discussion forum", target:"_blank", url:"/test3/forum/",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
]},
{code:"RIU Intranet", target:"_blank", url:"http://researchintouse.sharepointsite.com/",
sub:[ { size:[ "+self", 170 ], style:STYLE_SUBMENUS},
]},
];
Back to top
Paul Philpot



Joined: 09 May 2007
Posts: 6

PostPosted: Tue May 15, 2007 5:37 pm    Post subject: Reply with quote

By the way, here's the temporary link:

[url]http://www.researchintouse.com/new/index.php
Back to top
Paul Philpot



Joined: 09 May 2007
Posts: 6

PostPosted: Tue May 15, 2007 8:53 pm    Post subject: Reply with quote

FORGET MOST OF THE ABOVE.

I have recoded to remove the legacy code, and most of the problems are solved.

Sorry Alex, I should have read the upgrade instructions Surprised

I'll post a new topic with my remaining problem...

Smile
Back to top
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu All times are GMT
Page 1 of 1