Active parent, child: horizontal and vertical menus

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"
Locked
Napoleon
Forum Members
Forum Members
Posts: 12
Joined: Fri Oct 15, 2010 1:17 am

Active parent, child: horizontal and vertical menus

Post by Napoleon »

Hi all

I have downloaded a template and everything works fine except from one thing: It does not mark (or activate) the menu when clicked.

I have a horizontal and vertical menu with separate stylesheets. When a page in the horizontal menu is clicked a sub-menu appears as a vertical menu. I would like to configure it such that the horizontal menu is activated when clicked and stays activated when a sub-page in the vertical menu is chosen. I also want to activate the vertical menu pages when clicked.

I hope you understand. Otherwise, just say so.

Horizontal menu stylesheet:

Code: Select all

/********************
MENU
*********************/

/* hack for Internet Explorer */
* html div#menu_horiz {
   /* hide ie/mac \*/
   height: 1%;
   /* end hide */
}

/* 
background-color for the entire menu row, 
covering 100% of the width and text center-aligned 
*/
div#menu_horiz {
   background-color: #ECECEC;  /* background color for the entire menu row */
   width: 100%;
   margin: 0;
}

/* 
the menu ul box has top and left border, 
right border is provided by the li elements 
*/
div#menu_horiz ul {
   margin: 0;
   padding: 0;
   border-bottom: 1px solid #C0C0C0;
   border-left:  1px solid #C0C0C0;
   height:2.2em;
}


/* menu list items */
div#menu_horiz li {
   float: left; /* makes the list horizontal */
   list-style: none; /* hides the list bullet */ 
   margin: 0 ;
   border-right: 1px solid #C0C0C0;
}


/* the links, that is each list item */
div#menu_horiz a {
   padding: .6em 1em .6em 1.4em; /* padding inside the list item box */
   margin: 0; /* margin outside each list item box */
   text-decoration: none; /* no underline for links */
   color: #18507C;
   background: url(/cmsmadesimple/uploads/Clean_Red/arrow-right.gif) no-repeat 0.5em center; ;
   display: block; /* IE has problems with this, fixed above */
}


/* hover state for links */
div#menu_horiz li a:hover {
   background-color: #C3D4DF;
}
div#menu_horiz a.activeparent:hover {
   background-color: #C3D4DF;
   color: #18507C;
}

/* active parent, that is the first-level parent of a child page that is the current page */
div#menu_horiz li.activeparent a {
   background: #C42924 url(/cmsmadesimple/uploads/Clean_Red/arrow-down.gif) no-repeat 0.4em center; 
   color: #fff;
}

div#menu_horiz h3 {
   padding: .6em 1em .6em 1.4em; /* padding inside the list item box */
   margin: 0; /* margin outside each list item box */
   text-decoration: none; /* no underline for links */
   color: #fff;
   background: #C42924 url(/cmsmadesimple/uploads/Clean_Red/arrow-right-active.gif) no-repeat 0.4em center; ;
   display: block; /* IE has problems with this, fixed above */
   font-size: 1em;                           /* instead of the normal font size for <h3> */
}
Vertical menu stylesheet:

Code: Select all

/********************
MENU
*********************/
#menu_vert {
   padding-left: 0;
   margin-left: 1em;
}


/* third level has some padding to have it stand out */
div#menu_vert ul ul ul {
   padding-bottom: 0.5em;
}

/* menu li block */
#menu_vert li {
   list-style: none;
   margin: 0;
   border-bottom: 1px solid #c0c0c0;
   display: block;
}

#menu_vert ul ul li {
   border: none;
}

/** fix stupid ie bug with display:block; **/
* html #menu_vert li a { height: 1%; } 
* html #menu_vert li hr { height: 1%; }
/** end fix **/

/* first level links */
div#menu_vert a {
   text-decoration:none; /* no underline for links */
   display: block; /* IE has problems with this, fixed above */
   padding: 0.8em 0.5em 0.8em 1.5em; /* some air for it */
   color: #18507C; /* this will be link color for all levels */
   background: url(/cmsmadesimple/uploads/Clean_Red/arrow-right.gif) no-repeat 0.5em center; 
   min-height:1em; /* Fixes IE7 whitespace bug */ 
}

/* next level links, more padding and smaller font */
div#menu_vert ul ul a {
   font-size: 90%;
   padding: 0.5em 0.5em 0.5em 2.8em;
   background-position: 1.5em center;
}

/* third level links, more padding */
div#menu_vert ul ul ul a {
   padding: 0.3em 0.5em 0.3em 4.3em;
   background: url(/cmsmadesimple/uploads/Clean_Red/dash.gif) no-repeat 2.8em center; 
}

/* hover state for all links */
div#menu_vert a:hover {
   background-color: #C3D4DF;
}
div#menu_vert a.activeparent:hover {
   background-color: #C3D4DF;
   color: #18507C;
}

/* 
active parent, that is the first-level parent 
of a child page that is the current page 
*/
div#menu_vert li a.activeparent {
   background: url(/cmsmadesimple/uploads/Clean_Red/arrow-down.gif) no-repeat 0.4em center; 
   background-color: #385C72;
   color: #fff;
}

div#menu_vert ul ul li a.activeparent {
   background-position: 1.5em center; 
   background-color: transparent;
   color: #18507C;
}


/* 
current pages in the default Menu Manager 
template are unclickable. This is for current page on first level 
*/
div#menu_vert ul h3 {
   background: url(/cmsmadesimple/uploads/Clean_Red/arrow-right-active.gif) no-repeat 0.4em center;
   background-color: #385C72;
   display: block; 
   padding: 0.8em 0.5em 0.8em 1.5em;  /* some air for it */
   color: #fff;                                 /* this will be link color for all levels */
   font-size: 1em;                           /* instead of the normal font size for <h3> */
   margin: 0;                                  /* as <h3> normally has some margin by default */
}

/* 
next level current pages, more padding, 
smaller font and no background color or bottom border 
*/
div#menu_vert ul ul h3 {
   font-size: 90%;
   padding: 0.3em 0.5em 0.3em 2.8em;
   background-position: 1.4em center;
   background-color: transparent;
   border-bottom: none;
   color: #000;     
}

/* current page on third level, more padding */
div#menu_vert ul ul ul h3 {
   padding: 0.3em 0.5em 0.3em 4.3em;
   background: url(/cmsmadesimple/uploads/Clean_Red/arrow-right-active.gif) no-repeat 2.7em center; 
}

/* section header */
div#menu_vert li.sectionheader {
   border-right: none;
   font-size: 130%;
   font-weight: bold;
   padding: 1.5em 0 0.8em 0;
   background-color: #fff;
   line-height: 1em;
   margin: 0;
   text-align:center;
}



/* separator */
div#menu_vert li.separator {
   height: 1px !important;
   margin-top: -1px;
   margin-bottom: 0;
   padding:2px 0 2px 0;
   background-color: #000;
   overflow:hidden !important;
   line-height:1px !important;
   font-size:1px; /* for ie */
}

div#menu_vert li.separator hr {
   display: none; /* this is for accessibility */
}
Any ideas on how to get it working?

Thanks in advance.

/Napoleon.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Active parent, child: horizontal and vertical menus

Post by Dr.CSS »

I helps to have a link to the site for these kinds of questions, else we just guessing...
Napoleon
Forum Members
Forum Members
Posts: 12
Joined: Fri Oct 15, 2010 1:17 am

Re: Active parent, child: horizontal and vertical menus

Post by Napoleon »

Okay, I see. Here is the url: http://www.svinningebk.dk/
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Active parent, child: horizontal and vertical menus

Post by Dr.CSS »

First fix the validation errors then we work on menu...

http://validator.w3.org/check?verbose=1 ... ronzepoint
Napoleon
Forum Members
Forum Members
Posts: 12
Joined: Fri Oct 15, 2010 1:17 am

Re: Active parent, child: horizontal and vertical menus

Post by Napoleon »

I have now fixed the validation errors (thanks, Dr.CSS), but the menus are still not working properly as described in post #1.

Could my document outline cause some problems? Here it is (for the page "Home")
[h1] Svinninge Bridgeklub
[h2] Navigation
[h2] Sub Navigation
[h2] Hjem

Here is my template:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da" lang="da">
<!-- Change lang="da" to the language of your site -->

<head>

<title>{sitename} - {title}</title>
<!-- The sitename is changed in Site Admin/Global settings. {title} is the name of each page -->

{metadata}
<!-- Don't remove this! Metadata is entered in Site Admin/Global settings. -->

{stylesheet}
<!-- This is how all the stylesheets attached to this template are linked to -->

{cms_selflink dir="start" rellink=1}
{cms_selflink dir="prev" rellink=1}
{cms_selflink dir="next" rellink=1}
<!-- Relational links for interconnections between pages, good for accessibility and Search Engine Optmization -->

{literal}
<__script__ type="text/JavaScript" charset="utf-8">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
	var nw="auto",w=document.documentElement.clientWidth;
	if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}
</style>
<![endif]-->
{/literal}
<!-- The min and max page width for Internet Explorer is set here. For other browsers it's in the stylesheet "Layout: Top menu + 2 columns" -->

<!--<__script__ type="text/javascript" src="http://www.svinningebk.dk/lib/jquery/js/jquery.js"></__script>
<__script__ type="text/javascript" src="http://www.svinningebk.dk/lib/jquery/js/iframe.js"></__script>-->

<__script__ type="text/javascript" charset="ISO-8859-1" src="http://www.svinningebk.dk/lib/jquery/js/jquery-1.4.3.min.js"></__script>
<__script__ type="text/javascript" charset="ISO-8859-1" src="http://www.svinningebk.dk/lib/jquery/js/jquery.iframe-auto-height.plugin.js"></__script>

</head>

</__body>

<div id="pagewrapper">

    <!-- start accessibility skip links -->
    <ul class="accessibility">
      <li>{anchor anchor='menu_vert' title='Skip to navigation' accesskey='n' text='Skip to navigation'}</li>
      <li>{anchor anchor='main' title='Skip to content' accesskey='s' text='Skip to content'}</li>
    </ul>
    <!-- end accessibility skip links -->


    <hr class="accessibility" />
    <!-- Horizontal ruler that is hidden for visual browsers by CSS -->


   <!-- Start Header, with logo image that links to the default start page. Logo image is changed in the stylesheet  "For template: Top menu + left submenu + 1 column" -->
   <div id="header">
           <h1>{cms_selflink dir="start" text="$sitename"}</h1>
   <hr class="accessibility" />
   </div>
   <!-- End Header -->


   <!-- Start Navigation -->
   <div id="menu_horiz">
      <h2 class="accessibility">Navigation</h2>
      {menu template='simple_navigation.tpl' number_of_levels='1'}
   <hr class="accessibility" />
   </div>
   <!-- End Navigation -->


   <!-- Start Search-->
   <div id="search">
          {search}
   </div>
   <!-- End Search -->

   <!-- Start Breadcrumbs -->
   <div class="breadcrumbs">
        {breadcrumbs starttext='Du er her' root='Home' delimiter='&raquo;'}
   <hr class="accessibility" />
   </div>
   <!-- End Breadcrumbs -->


   <!-- Start Content (Navigation and Content columns) -->
   <div id="content">

      <!-- Start Sidebar -->
      <div id="sidebar">

      <!-- Start Sub Navigation -->
      <div id="menu_vert">
         <h2 class="accessibility">Sub Navigation</h2>

          <!-- NB! The <ul><li> below is only added because several default templates use the same menu stylesheet, to "force" the subnavigation to act as if it's the second level in a list -->
          <ul><li>{menu template='simple_navigation.tpl' start_level='2' collapse='1'}</li></ul>
      <hr class="accessibility" />
      </div>
      <!-- End Sub Navigation -->

      </div>
      <!-- End Sidebar -->


      <!-- Start Content Area -->
<div id="main">
<div style="float:right">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a href="http://www.addthis.com/bookmark.php?v=250&username=xa-4d2753527f2a94d9" class="addthis_button_compact">Del</a>
<span class="addthis_separator">|</span>
<a class="addthis_button_email" title="Tip en ven"></a>
<a class="addthis_button_print"></a>
<a class="addthis_button_facebook" title="Del via facebook"></a>
<a class="addthis_button_favorites" title="Føj til foretrukne"></a>
</div>
<__script__ type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d2753527f2a94d9"></__script>
<!-- AddThis Button END -->
</div>

<!-- <h2>{title}</h2> -->
         {content} <br />

         <!-- Start relational links -->
	 <div class="hr"></div>
	 <div class="right49">
	 	<p>{anchor anchor='main' text='^ Top'}</p>
	 </div>
         <div class="left49">
            <p>{cms_selflink dir="previous" label="Forrige side: "} <br />
                 {cms_selflink dir="next" label="Næste side: "} <br />
            </p>
         </div>
         <!-- The label parameter doesn't need to be there if you're using English, but is here to show how it's used if you don't want the English text "Previous page" -->
	 <!-- End relational links -->

      <hr class="accessibility" />
      </div>
	  <!-- End Content Area -->


   </div>
   <!-- End Content -->


   <!-- Start Footer. Edit the footer in the Global Content Block called "footer" -->
   <div id="footer">
      {global_content name='footer'}
   </div>   
   <!-- End Footer  -->


</div><!-- end pagewrapper -->

<__body>
</__html>
Any ideas?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Active parent, child: horizontal and vertical menus

Post by Dr.CSS »

First off don't bump, we will get back to you as soon as we can...

This is a known problem with menu manager and is fixed when 1.9.3 is released, which should be the end of the month, this weekend or next...
Napoleon
Forum Members
Forum Members
Posts: 12
Joined: Fri Oct 15, 2010 1:17 am

Re: Active parent, child: horizontal and vertical menus

Post by Napoleon »

Okay, fair enough. I'm looking forward to hear more about the update.
Locked

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