Welcome, Guest. Please login or register.
Did you miss your activation email?
March 18, 2010, 03:11:29 AM

Login with username, password and session length
Search:     Advanced search
Please Read - How to Get Help!

Participate in the forum and earn Great Rewards!
52057 Posts in 14862 Topics by 127570 Members
Latest Member: tomrom2002
* Home Help Login Register
+  Joomlashack Customization Forum
|-+  Commercial Joomlashack Products
| |-+  Element Templates
| | |-+  Guide: template_css.css modifications to create a drop down menu
« previous next »
Pages: [1] 2 Print
Author Topic: Guide: template_css.css modifications to create a drop down menu  (Read 47967 times)
Sle@per
Full Member
***
Offline Offline

Posts: 40


WWW
« on: November 06, 2006, 10:17:03 PM »

Hi all,

After being completely frustrated and fed up with my menu (I'm sorry it was just too figity for me), a good friend of mine helped my modify the code to create drop down menu's for the top menu in Elements.

Here is the code that was modified to create the effect seen at www.belton.co.nz . Please note the width is auto and will depend on the largest child item in the menu.

************************************************************************************

add this stuff (change existing) match colour for your site


#navbar li {
padding: 0;
margin: 0;
display: block;
float: left;
position: relative;
background: url(../images/menubar.png) 100% 0 no-repeat;
}


#navbar li ul {
width: auto;
display: none;
margin: 0;
padding: 0;
position: absolute;
top:33px;
min-height: 20px;
left: 0;
background:#333 url(../images/navbar_over.png) bottom repeat-x;
}


#navbar ul#mainlevel li a:hover, #navbar ul#mainlevel li:hover a {




#navbar a, #navbar ul#mainlevel li:hover ul li a? {
color: #fff;
text-decoration: none;
cursor: pointer;
}




#navbar ul#mainlevel li:hover ul li a {
background: none;
}
#navbar ul#mainlevel ul {
/* left: auto; */
white-space: nowrap;
}
*html #navbar ul#mainlevel ul {
width: 1px;
}


ul#mainlevel li {
position: relative;
}




#navbar ul#mainlevel ul li, #navbar ul#mainlevel ul li a {
display: block;
float: none;
}
#navbar ul#mainlevel ul li a.sublevel {
width: auto;
}
#navbar ul#mainlevel li ul li a:hover {
background:none;
color:#CC3300;
}

****************************************************************
Should be all of it. Feel free to correct me if you can do it better.

Please note I check with Barrie and he was more than happy for me to post here, even though Joomlashack is a business and makes money from modding work. Big ups.
Logged

"lifes like a game, level up"
boxes
Full Member
***
Offline Offline

Posts: 55


« Reply #1 on: November 07, 2006, 08:42:05 AM »

Thanks so much, looks nice Cheesy

Would there be any way to add Down Arrows in top menu items that contain sub items?

The down arrow should not appear in all top items, just those with sub items.

Thanks again Smiley
Logged
Sle@per
Full Member
***
Offline Offline

Posts: 40


WWW
« Reply #2 on: November 07, 2006, 02:40:56 PM »

Hey boxes,

there is .. but I have no idea how .. Good news is a good friend of mine is looking into for me as we speak. I'll post an update when I have one.
Logged

"lifes like a game, level up"
boxes
Full Member
***
Offline Offline

Posts: 55


« Reply #3 on: November 08, 2006, 05:39:16 AM »

Super! Thanks Smiley
Logged
ijames
Jr. Member
**
Offline Offline

Posts: 15


« Reply #4 on: November 10, 2006, 07:40:07 AM »

Hello Good Sir!

I love the drop down menus. I've added them to a site I'm building. I've noticed that menus don't expand to fit the text in firefox 1.5 for mac. I'm wondering if anybody knows why that might be.

Thanks,
James
Logged
Sle@per
Full Member
***
Offline Offline

Posts: 40


WWW
« Reply #5 on: November 15, 2006, 01:43:21 AM »

Hi,

we checked this and it seems to work fine .. anyone else having this problem .. with firefoxx on mac and dropdowns?
Logged

"lifes like a game, level up"
Weseal
Jr. Member
**
Offline Offline

Posts: 2


« Reply #6 on: November 15, 2006, 11:34:37 AM »

Hello,
Thank you so much for the great information.  Although i am having one small problem with the above.  I did as told but i only get one of the sub links to show up even if i have many under the one top level link.  is there something i am missing.  thanks for  any help inadvance.
Rich

ps am i suppose to just add (cut and paste) the above code or modify the exsisting code?  sorry for such a newbie question
thanks
« Last Edit: November 15, 2006, 02:35:25 PM by Weseal » Logged
ijames
Jr. Member
**
Offline Offline

Posts: 15


« Reply #7 on: November 15, 2006, 02:45:44 PM »

Hmmmm. And you tried with the pre 2.0 version? That's odd. I'll double check.

James
Logged
Weseal
Jr. Member
**
Offline Offline

Posts: 2


« Reply #8 on: November 15, 2006, 03:20:13 PM »

i think i may not be editing the code correctly do i just add to the exisiting css code or do i need to modifiy the exisiting code?  Part of the problem may be i am just not doing it correctly.  alittle more instruction probably would get the issue fixed.
thanks
« Last Edit: November 20, 2006, 09:43:46 AM by Weseal » Logged
camelx99
Jr. Member
**
Offline Offline

Posts: 3


« Reply #9 on: November 17, 2006, 12:31:06 AM »

Sorry for our ignorance but we tried to apply it on our website without success.  Roll Eyes
We are not technical skilled (limited to copy and paste) therefore we would appreciate if somebody could explain in detail what we need to do to get this up and running. The Element template is great and the topmenu is nice but not practical. Therefore we would like to get a little more information to apply the changes.

Thanks a lot, Rik
Logged
Sle@per
Full Member
***
Offline Offline

Posts: 40


WWW
« Reply #10 on: November 23, 2006, 03:22:53 AM »

you need to modify the existing code to look like the code pasted here.

Logged

"lifes like a game, level up"
Detlef Eric Hinz
Jr. Member
**
Offline Offline

Posts: 1


« Reply #11 on: December 05, 2006, 04:18:25 PM »

Hi,

I don't know which code I have to add and which I have to replace. Could you publish the whole part of the css here? That would be very nice, I love your alterations!

Thanks a lot, best wishes
Eric

Hi all,

After being completely frustrated and fed up with my menu (I'm sorry it was just too figity for me), a good friend of mine helped my modify the code to create drop down menu's for the top menu in Elements.

Here is the code that was modified to create the effect seen at www.belton.co.nz . Please note the width is auto and will depend on the largest child item in the menu.

************************************************************************************

add this stuff (change existing) match colour for your site


#navbar li {
padding: 0;
margin: 0;
display: block;
float: left;
position: relative;
background: url(../images/menubar.png) 100% 0 no-repeat;
}


#navbar li ul {
width: auto;
display: none;
margin: 0;
padding: 0;
position: absolute;
top:33px;
min-height: 20px;
left: 0;
background:#333 url(../images/navbar_over.png) bottom repeat-x;
}


#navbar ul#mainlevel li a:hover, #navbar ul#mainlevel li:hover a {




#navbar a, #navbar ul#mainlevel li:hover ul li a? {
color: #fff;
text-decoration: none;
cursor: pointer;
}




#navbar ul#mainlevel li:hover ul li a {
background: none;
}
#navbar ul#mainlevel ul {
/* left: auto; */
white-space: nowrap;
}
*html #navbar ul#mainlevel ul {
width: 1px;
}


ul#mainlevel li {
position: relative;
}




#navbar ul#mainlevel ul li, #navbar ul#mainlevel ul li a {
display: block;
float: none;
}
#navbar ul#mainlevel ul li a.sublevel {
width: auto;
}
#navbar ul#mainlevel li ul li a:hover {
background:none;
color:#CC3300;
}

****************************************************************
Should be all of it. Feel free to correct me if you can do it better.

Please note I check with Barrie and he was more than happy for me to post here, even though Joomlashack is a business and makes money from modding work. Big ups.
Logged
camelx99
Jr. Member
**
Offline Offline

Posts: 3


« Reply #12 on: December 21, 2006, 01:45:10 AM »

Is there sombody who can help newbie's a step further. I tried it several times without success and it looks I'm not the only one....

Thanks a lot, Rik
Logged
Dean Marshall
Hero Member
*****
Offline Offline

Posts: 2850



WWW
« Reply #13 on: December 21, 2006, 01:45:43 PM »


After you change the StyleSheet code and re-upload your modified file(s) (always keep backups of the originals)
you will need to force your browser to load the updated stylesheets rather than the previously stored version.
Load your site in your favourite browser (Firefox hopefully - but IE will just about work too).
Hold down the shift key on your keyboard and with your mouse click on the reload or refresh button on the browser's toolbar.

That should do it - as long as the stylesheets are correct.

On A Related Note

A note on IE7 - this browser no longer requires the suckerfish javascript in order to function - in fact the old javascript causes problems with IE7. The problem is that a lot of users still have IE6 so we can't just disregard or throw away the javascript.

Instead we have to make it load conditionally - only for IE versions before version 7.
If your copy of the template has the following code within it:
Code:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
navHover = function() {
var lis = document.getElementById("navbar").getElementsByTagName("LI");
for (var i=0; i<lis.length; i++) {
lis[i].onmouseover=function() {
this.className+=" sfhover";
}
lis[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
//--><!]]>
</script>


Remove the above code from the template - Place the following code in a new .js file at /templates/<name-of-template>/js/iehover.js
Code:
navHover = function() {
var lis = document.getElementById("navbar").getElementsByTagName("LI");
for (var i=0; i<lis.length; i++) {
lis[i].onmouseover=function() {
this.className+=" sfhover";
}
lis[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", navHover);

For your convenience - This code is now attached to this message as a separate file

Now we will load this code conditionally upon the browser being Internet Explorer and the version being less than 7.
Place the following code in before the </head> code in the template's index.php file
Code:
<!--[if lt IE 7]>
  <script type="text/javascript" language="javascript" src="<?php echo $mosConfig_live_site?>/templates/<?php echo $mainframe->getTemplate();?>/js/iehover.js"></script>
<![endif]--> 

Dean
Logged

Dean Marshall

Dean Marshall Consultancy Limited
Joomla web designers and expert Joomla consultants
http://www.deanmarshall.co.uk/ and http://www.lancasterwebdesigners.co.uk/
Barrie North
Administrator
Hero Member
*****
Offline Offline

Posts: 1181



« Reply #14 on: December 27, 2006, 02:44:34 PM »

Stickied!
Logged

eddifr
Jr. Member
**
Offline Offline

Posts: 3


« Reply #15 on: December 31, 2006, 03:01:29 AM »

Hi all,

After being completely frustrated and fed up with my menu (I'm sorry it was just too figity for me), a good friend of mine helped my modify the code to create drop down menu's for the top menu in Elements.

Here is the code that was modified to create the effect seen at www.belton.co.nz . Please note the width is auto and will depend on the largest child item in the menu.

************************************************************************************

add this stuff (change existing) match colour for your site


#navbar li {
padding: 0;
margin: 0;
display: block;
float: left;
position: relative;
background: url(../images/menubar.png) 100% 0 no-repeat;
}


#navbar li ul {
width: auto;
display: none;
margin: 0;
padding: 0;
position: absolute;
top:33px;
min-height: 20px;
left: 0;
background:#333 url(../images/navbar_over.png) bottom repeat-x;
}


#navbar ul#mainlevel li a:hover, #navbar ul#mainlevel li:hover a {




#navbar a, #navbar ul#mainlevel li:hover ul li a? {
color: #fff;
text-decoration: none;
cursor: pointer;
}




#navbar ul#mainlevel li:hover ul li a {
background: none;
}
#navbar ul#mainlevel ul {
/* left: auto; */
white-space: nowrap;
}
*html #navbar ul#mainlevel ul {
width: 1px;
}


ul#mainlevel li {
position: relative;
}




#navbar ul#mainlevel ul li, #navbar ul#mainlevel ul li a {
display: block;
float: none;
}
#navbar ul#mainlevel ul li a.sublevel {
width: auto;
}
#navbar ul#mainlevel li ul li a:hover {
background:none;
color:#CC3300;
}

****************************************************************
Should be all of it. Feel free to correct me if you can do it better.

Please note I check with Barrie and he was more than happy for me to post here, even though Joomlashack is a business and makes money from modding work. Big ups.
Hi mate, do you think it would it be possible for you, to upload the entire css, instead of only some code rows?
I tried a lot to change it with your code rows, but after a lot of tries I'm still here.
Please help me because I also need a drop down menu, i have many items to publish.
Thank you very much and best regards!!  Smiley
Logged
Brik182
Jr. Member
**
Offline Offline

Posts: 2


« Reply #16 on: January 04, 2007, 11:50:54 PM »

i got this working BUT ... i have a flash rotator underneath the menu and the hover submenu appears under it. Any ideas?
Logged
Kelly Paradis
Jr. Member
**
Offline Offline

Posts: 3



« Reply #17 on: January 06, 2007, 06:23:05 PM »

I tried modifying mine too, and in the end, I just ended up downloading the actual file from
 http://www.belton.co.nz and loading it and now it works great.  But since I didn't ask permission to grab it off the site, I've loaded it onto my work site so those of you that want it can download it from there instead of hitting the belton site.

Here you go! This is the complete working template_css.css file (I haven't read the IE7 fixes, so those aren't in here if that was an issue in this file.)

www.agristar.com/element/template_css.css

Just put it in your browser URL bar and it should pop up a message asking you if you want to download this file and where you'd like to save it. 

Save it locally (and as someone else mentioned, make a backup of your original, just in case) and then just replace your file in your \css folder.

Thanks so much for all the help in this forum...this is my first post, but I have really learned a lot reading through these forums.

Kelly
Logged
eddifr
Jr. Member
**
Offline Offline

Posts: 3


« Reply #18 on: January 07, 2007, 10:05:47 AM »

I tried modifying mine too, and in the end, I just ended up downloading the actual file from
 http://www.belton.co.nz and loading it and now it works great.  But since I didn't ask permission to grab it off the site, I've loaded it onto my work site so those of you that want it can download it from there instead of hitting the belton site.

Here you go! This is the complete working template_css.css file (I haven't read the IE7 fixes, so those aren't in here if that was an issue in this file.)

www.agristar.com/element/template_css.css

Just put it in your browser URL bar and it should pop up a message asking you if you want to download this file and where you'd like to save it. 

Save it locally (and as someone else mentioned, make a backup of your original, just in case) and then just replace your file in your \css folder.

Thanks so much for all the help in this forum...this is my first post, but I have really learned a lot reading through these forums.

Kelly
Thanks a lot Kelly!!!
You was much precious!!!  Wink  Wink
Logged
TJ
Administrator
Hero Member
*****
Offline Offline

Posts: 3272


Well, isn't that nice?


WWW
« Reply #19 on: January 27, 2007, 01:56:07 AM »

Thanks Kelly for providing the help....

I've attached the file with the changes to this post, if anyone still needs it.... Smiley

I must say, thanks to everyone for all of your input and for helping each other!  After all, that's what a forum is all about, eh!

peace,

tj
Logged

My Angel Azaria
-
Not getting the answers you need?  Please Read - How to Get Help!
Can't wait for free help? Check out Opens Source Support Desk
TJ
Administrator
Hero Member
*****
Offline Offline

Posts: 3272


Well, isn't that nice?


WWW
« Reply #20 on: January 27, 2007, 01:57:32 AM »

i got this working BUT ... i have a flash rotator underneath the menu and the hover submenu appears under it. Any ideas?

You need to add a z-index to your navbar.....

peace,

tj
Logged

My Angel Azaria
-
Not getting the answers you need?  Please Read - How to Get Help!
Can't wait for free help? Check out Opens Source Support Desk
deadlydave
Full Member
***
Offline Offline

Posts: 32


« Reply #21 on: January 30, 2007, 06:45:03 AM »

Well I finally sorted it,  thanks for your post on this guys!!  Grin


One think I can't seem to find in my css template to fix now since I uploaded yours...  where on earth is the 'current page' text colour on the menu bar?

www.dx2promotions.com/fanela


I seem to have it stuck in Red and I can't find it anywhere...  is it stored in a different file?
Logged
TJ
Administrator
Hero Member
*****
Offline Offline

Posts: 3272


Well, isn't that nice?


WWW
« Reply #22 on: January 30, 2007, 08:03:14 AM »

Hello,

Look for the following code in your template_css.css file, toward the bottom of the file:

Code:
#navbar ul#mainlevel li a#active_menu {
color: #c30;
cursor: default;
}

Change your color there...... Smiley

peace,

tj

Logged

My Angel Azaria
-
Not getting the answers you need?  Please Read - How to Get Help!
Can't wait for free help? Check out Opens Source Support Desk
Claus Egholm Nielsen
Jr. Member
**
Offline Offline

Posts: 2


« Reply #23 on: January 30, 2007, 02:29:56 PM »

Although i am having one small problem with the above.  I did as told but i only get one of the sub links to show up even if i have many under the one top level link.  is there something i am missing.  thanks for  any help inadvance.
Rich

I had the same problem. You can fix it by changing the #navcontainer. Change "overflow: hidden;" to "overflow:visible;".
Like this:

#navcontainer {
   background: url(../images/menubg2.png) repeat-x;
   height: 60px;
   padding: 0px 0px 0px 15px;
   overflow: visible;
   position:relative;
}

I have no idea if this is propper code, but hey! - it works... Wink
**Claus
« Last Edit: January 30, 2007, 02:36:43 PM by Claus Egholm Nielsen » Logged
juju
Jr. Member
**
Offline Offline

Posts: 7


« Reply #24 on: February 11, 2007, 03:35:33 PM »

Think its a bunch of hog wash or someone is leaving something out because it does not work even putting your own color in.
Back to the drawing board with me...Sheeeeeeee Yea, I can get a drop down but only one level and across...I want full drop down with category's... 
« Last Edit: February 11, 2007, 03:55:58 PM by juju » Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
 

About Joomlashack | Privacy Policy | Terms of Service | Powered by Joomla | Affiliates | Contact Us

Joomlashack designs free and commercial Joomla Templates and Joomla Websites
Learn how to Joomla with our Joomla Tutorials or join our Joomla Template Club
Copyright 2005-2009 Joomlashack. All rights reserved unless otherwise stated.
The Joomla! name is used under a limited license from Open Source Matters.