I found many people in the forum asking for a way to add a drop down menu to their templates,
It's easy to do it, we'll discuss this step by step, we'll use the "Red Evolution Aphelion" as an example template
First we'll create a new module position in the template, let's call it "hornav", to make this new position accessible in the admin panel we need to add it to "/templates/redevo_aphelion/templateDetails.xml" open that file and add the following code under "<positions>"
Code: Select all
<position>hornav</position>
Code: Select all
<?php if($this->countModules('top')) : ?>
<div id="top">
<jdoc:include type="modules" name="top" style="xhtml" />
</div><!--top-->
<?php endif; ?>
Code: Select all
<?php if ($this->countModules('hornav')): ?>
<div id="hornav">
<jdoc:include type="modules" name="hornav" />
</div>
<?php endif; ?>
(Note: If you choose a div id other than "hornav" you need to edit moomenu.js)
Let's include "moomenu.js" in our template, add this code in the last line of the head section in the template index.php
Code: Select all
<?php if ($this->countModules('hornav')): ?>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/moomenu.js"></script>
<?php endif; ?>
go to the admin panel >> Module Manager >> Click on the main menu
under "Details" change the "position" to "hornav"
under "Module Parameters" change "Always show sub-menu Items" to "yes"
under "Advanced Parameters" set "Menu Class Suffix" to "_horiz" (without quotes)
(Note: if you choose a menu class suffix other than _horiz you need to edit moomenu.js)
Hit save.
Now we need to add some css, open this file "/templates/redevo_aphelion/css/template.css" add this code to it
Code: Select all
#hornav{
clear:both;
display:block;
height:40px;
}
#hornav .moduletable{
margin:0;
}
#hornav ul{
margin:0;
padding:0;
width:auto;
}
#hornav ul li{
margin:0;
padding:0;
height:40px;
float:left;
position:relative;
}
#hornav ul li a{
color:#d0d0d0;
text-transform:uppercase;
padding:10px;
height:20px;
display: block;
background:url(../images/topmenu-vline.jpg) no-repeat;
background-position:0px 2px;
}
#hornav ul li a:hover{
text-decoration:none;
}
#hornav ul li ul {
display:block;
height:auto;
width: 14em;
position:absolute;
z-index:99;
left: -999em;
background-color:#333333;
}
#hornav ul li ul ul {
margin: -40px 0 0 14em;
}
#hornav ul li li {
width: 14em;
}
#hornav ul li li a{
color:#d0d0d0;
text-transform:none;
display: block;
background:none;
padding:10px;
}
#hornav ul li ul {
left: -999em;
}
#hornav ul li:hover ul ul, #hornav ul li:hover ul ul ul {
left: -999em;
}
#hornav ul li:hover ul, #hornav ul li li:hover ul, #hornav ul li li li:hover ul {
left: auto;
}
Code: Select all
#header .bgbl{
background:url(../images/headerbg_bl.jpg) no-repeat;
background-position:15px 100%;
height:auto!important;
height:100px;
min-height:100px;
padding:0px 24px 0px 24px;
position:relative;
}
Code: Select all
#header{
margin-top:16px;
background:#2f2f2f url(../images/headerbg_m.jpg) top left repeat-x;
color:#fff;
position:relative;
z-index: 1;
}
The redevo_aphelion template comes with different colors, if you use the orange color open this file "/templates/redevo_aphelion/css/orange.css" and add this code to it
Code: Select all
#hornav ul li a:hover{
background: transparent url(../images/orange/topmenu-bg.jpg) repeat-x;
background-position:0px 1px;
}
Note: This css is for the redevo_aphelion template, if you use a different one you need to adjust it to suit your template.
We're finished, congratulations! now you have a fully working horizontal drop down moomenu
Best Regards