Help needed for Vertical expanding menu

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
pimhd
Forum Members
Forum Members
Posts: 19
Joined: Mon Aug 28, 2006 12:47 pm

Help needed for Vertical expanding menu

Post by pimhd »

I would like some help for creating a menu. The menu i would like to achieve would be something like this:

1. INTRODUCTION (section header)
1.1 item1
1.2 item2
2. CONTACT (section header)
2.1 item3
2.2 item4

What i would like is to have the section headers closed by default. If you click on INTRODUCTION, it opens and item1 & item2 are shown. When you click on CONTENT, INTRODUCTION closes and item3 & item4 are shown.
When you click on an item it must stay in focus.

I tried to use the Section_Expand menu (below) and came a long way with it, only the other Section headers aren't closing when you click on one of them. Does anyone know how to do this? I don't understand much of the menu coding techniques (aer they all Smarty tags?)

Code: Select all

{* CSS classes used in this template:
#active - The active/current page
li#separator - To style the ruler for the separator
span.sectionheader - To style section header *}
{if $count > 0}
<__script__ type="text/javascript" language="javascript" src="lib/helparea.js"></__script>
<div class="menu">
<ul id="menu">
{assign var="prevdepth" value="1"}
{foreach from=$nodelist item=node}
{assign var="prevdepth" value=$prevnode->depth}
{if ($node->depth <= $prevdepth)}
{if ($prevnode->haschildren == "1")}<li></li></ul></div></li> {* bugfix if subitems were not shown in menu *}
{else}
{if $node->depth < $prevdepth}
{assign var="act_depth" value=$prevdepth-$node->depth}</li>
{while (($act_depth > 0) and ($collapseopened > 0))}
</ul></div></li>
{assign var="act_depth" value=$act_depth-1}
{assign var="collapseopened" value=$collapseopened-1}
{/while}
{else}
</li>
{/if}
{/if}
{/if}

{if $node->type == 'separator'}
<li id="separator"></li>
{else}
{if $node->current == true}<li id="active">
{else}<li>
{/if}
<a id="pic{$node->id}" {if $node->type != 'sectionheader'}href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}{/if}{if $node->haschildren == '1'}
{assign var="collapseopened" value=$collapseopened+1} onclick="expandcontent('sub{$node->id}')"{else}{/if} style="cursor:hand; cursor:pointer">
{if $node->type == 'sectionheader'}<span class="sectionheader">{/if}
{$node->menutext}
{if $node->type == 'sectionheader'}</span>{/if}
</a>
{if $node->haschildren == '1'}<div id="sub{$node->id}" class="expand"><ul>{/if}
{/if}
{assign var="prevnode" value=$node}
{/foreach}

{if ($prevnode->haschildren == "1")}<li></li></ul></div></li> {* bugfix if subitems were not shown in menu *}
{else}
{if $prevnode->depth > 1}
{assign var="act_depth" value=$prevnode->depth-1}</li>
{while (($act_depth > 0) and ($collapseopened > 0))}
</ul></div></li>
{assign var="act_depth" value=$act_depth-1}
{assign var="collapseopened" value=$collapseopened-1}
{/while}
{else}
</li>
{/if}
{/if}

</ul>
</div>
{/if}
cyberman

Re: Help needed for Vertical expanding menu

Post by cyberman »

Have you tried MenuManagers collapse parameter too?
pimhd
Forum Members
Forum Members
Posts: 19
Joined: Mon Aug 28, 2006 12:47 pm

Re: Help needed for Vertical expanding menu

Post by pimhd »

I've tried {menu template='Menu_Section_Expand' collapse='1'} in my template, but then only the first sectionheader will expand on click. When i click on the others, nothing happens
cyberman

Re: Help needed for Vertical expanding menu

Post by cyberman »

Can you post a link?
pimhd
Forum Members
Forum Members
Posts: 19
Joined: Mon Aug 28, 2006 12:47 pm

Re: Help needed for Vertical expanding menu

Post by pimhd »

I'm sorry, but i've allready given up on this one.

This menu-thing is a bit too complicated for me. Maybe i'll try again in the future, when i've got the time.
cyberman

Re: Help needed for Vertical expanding menu

Post by cyberman »

Think Section Header is not the right choice (dont work).

Maybe you should use a link (content type) with a link to the first submenu entry ...
pimhd
Forum Members
Forum Members
Posts: 19
Joined: Mon Aug 28, 2006 12:47 pm

Re: Help needed for Vertical expanding menu

Post by pimhd »

In a way this is how the menu behaves at this stage (coming from the 'section header expand' template).

What i would like to achieve is a menu that behaves like this example, where javascript is used:
http://www.stunicholls.com/menu/tree_frog_vertical.html

So when you click on the section header it does nothing more than expand to the sub-items and not link to anything.
Last edited by pimhd on Wed Dec 19, 2007 9:31 am, edited 1 time in total.
Post Reply

Return to “Layout and Design (CSS & HTML)”