Drop-down menu solution?

This is a discussion on "Drop-down menu solution?" within the Web Page Design section. This forum, and the thread "Drop-down menu solution? 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 Apr 14th, 2008, 22:36
New Member
Join Date: Apr 2008
Location: Earth
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Drop-down menu solution?

Hello. I'm trying to make a drop-down menu based on a hierarchical unordered list system.

This is the code I tried to modify (so that it would work with my code):

Code: Select all
#navigation ul {
    position: absolute;
    top: 101px;
}
#navigation {
    width: 100%;
    background: #eee;
    float: left;
}
#navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    float: left;
}
#navigation a, #navigation h2 {
    font: bold 11px/16px arial, helvetica, sans-serif;
    display: block;
    margin: 0;
    padding: 2px 3px;
}
#navigation h2 {
    color: #fff;
    background: #000;
    text-transform: uppercase;
}
#navigation a {
    height: 25px;
    color: #000;
    background: #9F9F9F;
    text-decoration: none;
}
#navigation a:hover {
    color: #a00;
    background: #fff;
}
#navigation li {
    position: relative;
    margin: 0;
}
#navigation ul ul {
    position: absolute;
    z-index: 500;
    top: 23px;
    width: 200px;
}
#navigation ul ul li {
    width: 100%;
    border: 1px solid #000000;
    margin: 0;
    padding: 0;
}
#navigation ul ul ul {
    top: 0;
    left: 100%;
}
div#navigation ul ul, div#navigation ul li:hover ul ul, div#navigation ul ul li:hover ul ul {
    display: none;
}
div#navigation ul li:hover ul, div#navigation ul ul li:hover ul, div#navigation ul ul ul li:hover ul {
    display: block;
}
<!--[if IE]>
    <style type="text/css" media="screen">
    body {
        behavior: url(csshover.htc);
        font-size: 100%;
    }
    #navigation ul li {
        float: left;
        list-style: none;
    }
    #navigation ul li a {
        height: 1%;
    } 
    #navigation a, #navigation h2 {
        font: bold 0.7em/1.4em arial, helvetica, sans-serif;
    }
    </style>
<![endif]-->
This is all the CSS I have for #navigation:

Code: Select all
#navigation {
    height: 15px;
    background: url(images/nav.png) no-repeat;
}
#navigation ul li {
    float: left;
    list-style: none;
    margin-right: 3px;
}
#navigation ul li a {
    display: block;
    width: 100px;
    padding-top: 15px;
    overflow: hidden !important;
}
#navigation ul .navigation a {
    background: url(images/navigation.png) no-repeat;
}
#navigation ul .bof1 a {
    background: url(images/bof1.png) no-repeat;
}
#navigation ul .bof2 a {
    background: url(images/bof2.png) no-repeat;
}
#navigation ul .bof3 a {
    background: url(images/bof3.png) no-repeat;
}
#navigation ul .bof4 a {
    background: url(images/bof4.png) no-repeat;
}
#navigation ul .bof5 a {
    background: url(images/bof5.png) no-repeat;
}
#navigation ul li ul li {
    display: none;
    width: 200px;
    clear: both;
}
#navigation ul.bof1:hover ul .bof1menu {
    display: block;
    width: 200px;
}
This is my unordered list:

Code: Select all
                <ul>
                    <li class="navigation"><a href="#"></a></li>
                    <li class="bof1"><a href="#"></a></li>
                    <li class="bof2"><a href="#"></a></li>
                    <li class="bof3"><a href="#"></a></li>
                    <li class="bof4"><a href="#"></a></li>
                    <li class="bof5"><a href="#"></a></li>
                </ul>
Anyone know how I can get a drop-down menu to work?
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 Apr 18th, 2008, 12:10
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: Drop-down menu solution?

http://www.htmldog.com/articles/suckerfish/dropdowns/
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
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 Apr 18th, 2008, 16:54
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Drop-down menu solution?

Not sure suckerfish is the correct solution, as this can be done without the scripting with CSS and .htc file for IE.

Looking at your menu code you have no nested UL so the CSS you wrote can't target anything.

Code: Select all
<div id="nav">
<ul>
<li class="navigation"><a href=""></a>
<ul>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul>
</li>
<li><a href="">Menu Item 2</a></li>
<li><a href="">Menu Item 3</a></li>
<li><a href="">Menu Item 4</a></li>
</ul>
</div>
Basic CSS:

Code: Select all
#nav ul li ul {
display:none;
}

#nav ul li:hover ul {
display:block;
width:200px;
position:absolute;
left:auto
}
Thats the basics. See if that helps set you on the right track. Also get Whatever:hover for to make it work in IE. the whatever hover htc is well documented and simple to implement.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; Apr 18th, 2008 at 16:56. Reason: Adding link
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 Apr 18th, 2008, 23:14
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: Drop-down menu solution?

Good reply moojoo, but I can't see how your suggestion differs from suckerfish.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
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 Apr 19th, 2008, 15:37
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Drop-down menu solution?

Suckerfish requires javascript which scrubs the source and uses js to manipulate elements. Also utilizing a conditional comment is a better solution than using js browser sniffing as well, which suckerfish also handles via js. At any rate the solution I provided is probably easier and more direct than suckerfish is as well. Not that suckerfish is not a good solution, just think in this case it may be over kill.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; Apr 19th, 2008 at 15:41.
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 Apr 19th, 2008, 15:39
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Drop-down menu solution?

.htc is still a scripting file, and will not take effect if the user has Javascript disabled.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
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 Apr 20th, 2008, 14:40
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: Drop-down menu solution?

Popup menus cannot be achieved without any javascript because IE6 does not handle anything:hover. As aso186 said, if javascript is disabled, suckerfish or not, popup menus will not work in IE6. So why the js-phobia?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
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 Apr 20th, 2008, 21:48
Junior Member
Join Date: Apr 2008
Location: uk
Age: 23
Posts: 46
Thanks: 3
Thanked 0 Times in 0 Posts
Re: Drop-down menu solution?

cant offer direct help but http://www.cssplay.co.uk have loads of this type of menu, might be worthwhile checking it out?
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 Apr 22nd, 2008, 12:16
Junior Member
Join Date: Apr 2008
Location: BORO
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Drop-down menu solution?

I'll vouch for CSS play's quaility. I've used there stuff a number of times.

All they request is a link back for personal sites or an email to request permission on larger sites.

http://www.cssplay.co.uk/menus/dd_valid.html

The above link is a Cross browser CSS only DD menu.

Hope this helps
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 Apr 23rd, 2008, 14:44
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Drop-down menu solution?

Quote:
Originally Posted by aso186 View Post
.htc is still a scripting file, and will not take effect if the user has Javascript disabled.
Aso yes, but the htc method is a tad less obtrusive than suckerfish imo. Either way the end result is the same I guess. The menu should function with or without either, and sub links available on sub pages in some form. Simple enough in some no script tags or conditional depending on what you are using.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
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 May 2nd, 2008, 11:02
New Member
Join Date: May 2008
Location: india
Age: 21
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Drop-down menu solution?

Because the drop down menus are written Javascript the links created in the drop down menu are not relative and are therefore not updated when used on an actual page. This is important because the template is stored in a sub folder called template and not with the other HTML pages so the links are always wrong.
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, drop-down, html, menu

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
Drop-down Menu kaz JavaScript Forum 1 May 24th, 2007 10:32
I have a normal css menu, but want ot add drop down menu to it multichild Web Page Design 7 Jan 9th, 2007 16:07
Drop down menu ... Drysdale Web Page Design 3 Jul 21st, 2005 22:00
help with drop menu makemesick JavaScript Forum 8 Apr 25th, 2005 21:19
drop menu help makemesick JavaScript Forum 2 Apr 23rd, 2005 05:48


All times are GMT. The time now is 18:03.


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