A preview of what we are going to make (minus the grey background below as this is a screen shot from my site).
First of all, go download Extended Menu from Joomla’s Extension section and install it into your system. I hope you already know how to do this but if not, I’m sure there are loads of tutorials out there.
Next, go to Modules and click on the name to go into its settings. Go ahead and set it according to the ones I have.
3 important settings to note:
1. Choose the menu that you want Extended Menu to be applied on in the Menu Name.
2. Choose Tree List from Menu Style.
3. Make the menu expand till what you need but I would think 3 is the max for most of us.
Please note that you do have to leave the Menu Class Suffix and Module Class Suffix as blank so the CSS that I’m going to show you will work as I’m applying the styling to its default. Don’t worry, only the menu will be affected and not all the other links.
Copy and paste this wonderful chuck of code I modified from a CSS Dropdown Menu Tutorial by Harry Roberts into the CSS from your template. Go to Extensions > Template Manager > *Choose Template* > Edit CSS.
#mainlevel{
list-style:none;
/* Clear floats */
float:left;
width:800px;
margin:0px;
padding:0px 0px 0px 10px;
margin-top:2px;
/* Bring the nav above everything else--uncomment if needed.*/
position:relative;
z-index:5;
}
#mainlevel li{
float:left;
margin-right:30px;
position:relative;
}
#mainlevel a{
display:block;
padding:5px;
color:#900;
text-decoration:none;
}
#mainlevel a:hover{
color:#FFF;
background:#900;
text-decoration:none;
}
#mainlevel ul{
background:#fff; /* Adding a background makes the dropdown work properly in IE7+. Make this as close to your page's background as possible (i.e. white page == white background). */
background:rgba(255,255,255,0); /* But! Let's make the background fully transparent where we can, we don't actually want to see it if we can help it... */
list-style:none;
position:absolute;
margin:0px;
padding:0px;
left:-9999px; /* Hide off-screen when not needed (this is more accessible than display:none;) */
}
#mainlevel ul li{
padding-top:0px; /* Introducing a padding between the li and the a give the illusion spaced items */
float:none;
}
#mainlevel ul a{
white-space:nowrap; /* Stop text wrapping and creating multi-line dropdown items */
}
#mainlevel li:hover ul{ /* Display the dropdown on hover */
left:0; /* Bring back on-screen when needed */
}
#mainlevel li:hover a{ /* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */
background:#900;
color:#FFF;
text-decoration:none;
}
#mainlevel li:hover ul a{ /* The persistent hover state does however create a global style for links even before they're hovered. Here we undo these effects. */
text-decoration:none;
}
#mainlevel li:hover ul li a:hover{ /* Here we define the most explicit hover states--what happens when you hover each individual link. */
color:#CCC;
background:#790101;
}
I apologize for the poor styling of the code but I think its easier for you to browse than having the text wrapped within the block quote.
So if you have some basic knowledge of CSS, please go ahead and change them to your liking. If not, please do look for the Background: attribute to change the background color. Color: attribute in order to change the text color. If there is any other tweaking you want to achieve and don’t know how, please leave a comment so either myself or some wise developer can help you out.
Story: I was thinking of implementing a Dropdown Menu for my latest Joomla project and at first I thought it would be already in the default modules but I was wrong. So went on to search for some extensions that would make my life easier and after some recommendations, Extended Menu seems to be the winner.
Extended Menu is a no frills extension that uses pure HTML and CSS to allow developers to create a full (or more) W3C compliant site. Lazy me was thinking that a few switches will get me what I need and decided exploring. 15 minutes into my exploration and nothing worked! Was about to give up but went back to read the fine prints and noticed…”don’t use it if you are not sure what HTML/CSS is and you actually don’t care about web standards (accessibility etc.)”
This gives me a clue that I would most likely need to dwell into my own template’s file and do some tweaking. Wanted to see if any kind soul had any tutorial up and found one. Tried it but it seems to be for the previous versions and didn’t work. So that’s the reason for this tutorial and hope that it is of some help.