Css expanding menu ?

This is a discussion on "Css expanding menu ?" within the Web Page Design section. This forum, and the thread "Css expanding menu ? are both part of the Design Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Aug 27th, 2007, 11:02
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Css expanding menu ?

hi guys ...

havnt been around here for ages... so hello to you all <waves>.. i misse dyou all

Im trying to come up with a veritcal css menu that expands either on click or on hover... preferably without any javascript.

Cdan anyone recomend a tutorial, as im struggling to find something that fits the bill

Sorry for the short post... ill come back and say hi in the cafe properly later

acc
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Aug 27th, 2007, 11:45
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

Hey!!

Several flyout navs here all with css. Quite a few to choose from.
http://www.cssplay.co.uk/menus/

I've had good luck with this one as well. http://www.tanfa.co.uk/css/examples/menu/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 27th, 2007, 11:47
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

ive had to use a little JS linda my sweety

This is because i only want them to open onclick.... js was the easiest option.

It looks good... but, i have a new problem !

I have a hover and a normal and a "open" graphic for my buttons, now the normal and hover work fine, but i cant figure out how to show the "active" button when the menu is open.

a:active doesnt work (didnt think it would)

Any idea's?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Aug 27th, 2007, 11:51
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

Yes... selected state is done like this...
Code: Select all
<a href="index.html" class="selected">Home</a>
Css looks like this
Code: Select all
ul li a.selected {
    text-decoration: none;    
    font: bold small-caps 16px "MS Serif";
    color: #759EFF;    
    }
note that a colon is not used with this state.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Aug 27th, 2007, 11:53
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

im not sure that will work ... heres my html :

Code: Select all
<dl id="menu">
        <dt onclick="javascript:show('smenu1');"><a href="#">CD's and Music</a></dt>
            <dd id="smenu1">
                <ul>
                    <li><a href="#">MP3 Players</a></li>
                    <li><a href="#">CD's and Music</a></li>
                </ul>
            </dd>
            <dt onclick="javascript:show('smenu2');"><a href="#">Computing</a></dt>
            <dd id="smenu2">
                <ul>
                    <li><a href="#">Computers & Laptops</a></li>
                    <li><a href="#">Hardware</a></li>
                    <li><a href="#">Software</a></li>
                    <li><a href="#">Printers</a></li>
                    <li><a href="#">Satellite Navigation</a></li
                    <li><a href="#">MP3 Players</a></li>
                    <li><a href="#">Office Furnature</a></li>
                    <li><a href="#">Cameras</a></li>
                </ul>
            </dd>
            <dt onclick="javascript:show('smenu3');"><a href="#">DVD's and Video</a></dt>
            <dd id="smenu3">
                <ul>
                    <li><a href="#">DVD's</a></li>
                    <li><a href="#">DVD Rentals</a></li>
                </ul>
            </dd>
            <dt onclick="javascript:show('smenu4');"><a href="#">Electrical Goods</a></dt>
            <dd id="smenu4">
                <ul>
                    <li><a href="#">Home entertainment</a></li>
                    <li><a href="#">Satellite Navigation</a></li>
                    <li><a href="#">MP3 Players</a></li>
                    <li><a href="#">Kitchen Appliances</a></li>
                    <li><a href="#">Household Appliances</a></li>
                </ul>
            </dd>
</dl>
</div><!-- /leftdiv -->
and my css so far

Code: Select all
dl, dt, dd, ul, li {
margin: 0;
padding: 0;
list-style-type: none;
}
#menu {
width:151px;
}
#menu dt {
cursor: pointer;
margin: 2px 0;;
height: 32px;
line-height: 20px;
text-align: left;
font-weight: bold;
border: 1px solid gray;
background-image:url(../images/closedleft.jpg)
}
#menu dd {
border: 1px solid gray;
}
#menu li {
text-align: left;
}
#menu li a, #menu dt a {
color: #000;
text-decoration: none;
display: block;
border: 0 none;
height: 100%;
}
#menu dt a:hover{
background-image:url(../images/overleft.jpg)
}
#menu dt a:active{
background-image:url(../images/overleft.jpg)
}
#menu li a:hover, #menu dd a:hover, #menu dl a:hover {
background: #e90236;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Aug 27th, 2007, 11:54
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

i think ,ill need to assign a class via javascript when the "onclick" is true... but im not sure how to do this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Aug 27th, 2007, 11:56
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

Ah... I see... I have no experience with Javascript so hopefully someone else can help ya!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Aug 27th, 2007, 11:58
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

must be a echo command or somethign similar to php.... just not sure... rpint maybe lol... arg
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Aug 27th, 2007, 12:53
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

You'll need to get the id so it only affects the menu links then loop through all of the links withing the element with that id then add an onclick event handler that sets the bg image of the clicked element to the specified image and set all the others to the standard bg image.

Alterbatively you can change the class name of the 'active' nav item using JS. You need the alternative css style in the CSS fiel already of course. You would follow the same instructions as above but would set the class name rather than the bg property. Changing the class name seems to be a lot quicker than altering the bg style so it may be your best bet.

I'm actually doing something like this myself at the minute. I should be done withing the next few days. When I get it all working, I'll post up the script. It's not particularly difficult, to be honest.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Aug 27th, 2007, 14:16
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

thanks mate.... my js really does suck
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Aug 27th, 2007, 14:41
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Css expanding menu ?

Have you ever looked at quirksmode.org? It's the home of JavaScript-god-who-is Peter-Paul Koch. It's a brilliant site and I can also recommend his book PPK on JavaScript, likewise DOM Scripting by Jeremy Keith is also excellent. They aren't particularly technical but they show you how JS works, how it should work, when to use it etc and they also provide real world example. In Keith's book you basically put a site together with loads of funky and accessible JS features. The JS Bible is pretty good for the technical stuff, there are simply too many bits and bobs to remember so this is very useful.

Anyway, I should get to work on that script.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
css

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
expanding menu lisafelst12 Flash & Multimedia Forum 9 Apr 28th, 2008 20:16
Another Expanding Menu Problem mispris006 Web Page Design 0 Feb 8th, 2007 18:57
expanding menu brunette JavaScript Forum 3 Dec 7th, 2006 22:56


All times are GMT. The time now is 20:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42