View Full Version : Amazing dropdown menu
Bornfree
09-24-2013, 10:46 PM
Hi Guys,
Can some-one please let me know or point me in the right direction. I really like the menus on the following websites. Where can i make or create something like these. I don't have very much coding knowledge.
http://www.samsung.com/au/#latest-home
I like the above one as the small images change on mouse over showing the products.
http://www.kathmandu.com.au/
This is nice and simple. i would love this one
Deadweight
09-25-2013, 12:31 AM
This shall get you in the right path:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Large Box</title>
<style type="text/css">
body, html {
padding:0px;
margin:0px;
}
#ul_body {
list-style: none;
padding:0px;
margin:0px;
width: 80%;
margin: auto;
margin-top:5px;
}
#ul_body > li{
border: 1px solid black;
float:left;
margin-left: 5px;
padding: 2px 5px;
border-radius: 5px 5px 0 0;
border-bottom:none;
}
#ul_body > li:hover{
background-color: black;
color:white;
cursor:pointer;
}
#ul_body > li > div {
display:none;
margin:auto;
position:absolute;
background-color:black;
border:1px solid black;
margin-top:1px;
border-radius:10px;
margin-left: -20px;
padding: 3px;
max-width:70%;
cursor: default;
}
#ul_body > li:hover > div {
display:block;
}
/* Content below the links */
#content {
clear:both;
border-top:1px solid black;
background-color:blue;
border-bottom:1px solid black;
}
.main {
width: 80%;
margin: auto;
height:300px;
background-color: white;
border-left:1px solid grey;
border-right: 1px solid grey;
}
</style>
</head>
<body>
<div id="nav">
<ul id="ul_body">
<li>Link One<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Two<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Three<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Four<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Five<div>Lorem ipsum dolor sit amet</div></li>
</ul>
</div>
<div id="content">
<div class="main">
Content goes here
</div>
</div>
</body>
</html>
Something like this correct?
Bornfree
09-25-2013, 02:20 AM
Thank you very much for your time Crazykld69
I would like to have something like this one;http://www.samsung.com/au/#latest-home
Where on mouseover the image chages on the top side of the menu. Also the images have a different background then the menu itself.
Sorry to be a pain nut like i said am not a coder.
Deadweight
09-25-2013, 03:37 AM
So more of something like this:
(PS: Only look at first tab)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Large Box</title>
<style type="text/css">
body, html {
padding:0px;
margin:0px;
}
#ul_body {
list-style: none;
padding:0px;
margin:0px;
width: 80%;
margin: auto;
margin-top:5px;
}
#ul_body > li{
border: 1px solid black;
float:left;
margin-left: 5px;
padding: 2px 5px;
border-radius: 5px 5px 0 0;
border-bottom:none;
}
#ul_body > li:hover{
background-color: black;
color:white;
cursor:pointer;
}
#ul_body > li > div {
display:none;
margin:auto;
position:absolute;
background-color:black;
border:1px solid black;
margin-top:1px;
border-radius:10px;
margin-left: -20px;
padding: 3px;
max-width:70%;
cursor: default;
min-width: 200px;
text-align: center;
}
#ul_body > li:hover > div {
display:block;
}
ul.imgchange {
list-style:none;
padding:0;
margin:0;
}
ul.imgchange li {
cursor:pointer;
}
.onebyone > img{
width:100px;
height:100px;
padding:0;
}
/* Content below the links */
#content {
clear:both;
border-top:1px solid black;
background-color:blue;
border-bottom:1px solid black;
}
.main {
width: 80%;
margin: auto;
height:300px;
background-color: white;
border-left:1px solid grey;
border-right: 1px solid grey;
}
</style>
<script type="text/javascript">
function change_image(the_id,the_image){
x = document.getElementById(the_id);
x.innerHTML = '<img src="'+the_image+'" />';
}
</script>
</head>
<body>
<div id="nav">
<ul id="ul_body">
<li>Link One<div><div id="img1" class="onebyone">
<img src="http://industrial-supplies.biz/images/s-i/C48AS.jpg" />
</div>
<ul class="imgchange">
<li onmouseover="change_image('img1','http://www.clker.com/cliparts/7/H/K/N/L/g/crossed-hammers-bw-100x100-md.png')">Image One</li>
<li onmouseover="change_image('img1','http://industrial-supplies.biz/images/s-i/C48AS.jpg')">Image Two</li>
</ul>
</div>
</li>
<li>Link Two<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Three<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Four<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Five<div>Lorem ipsum dolor sit amet</div></li>
</ul>
</div>
<div id="content">
<div class="main">
Content goes here
</div>
</div>
</body>
</html>
Bornfree
09-25-2013, 06:11 AM
Thank you once again for you help Crazykld69
Yes thats what i'm trying to achive. How do i get row side by side and also i want the whole image section to have a white background. is it too much that am asking now?
Deadweight
09-25-2013, 03:22 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Large Box</title>
<style type="text/css">
body, html {
padding:0px;
margin:0px;
}
#ul_body {
list-style: none;
padding:0px;
margin:0px;
width: 80%;
margin: auto;
margin-top:5px;
}
#ul_body > li{
border: 1px solid black;
float:left;
margin-left: 5px;
padding: 2px 5px;
border-radius: 5px 5px 0 0;
border-bottom:none;
}
#ul_body > li:hover{
background-color: black;
color:white;
cursor:pointer;
}
#ul_body > li > div {
display:none;
margin:auto;
position:absolute;
background-color:white;
border:1px solid black;
margin-top:1px;
border-radius:10px;
margin-left: -20px;
padding: 3px;
max-width:70%;
cursor: default;
min-width: 200px;
text-align: center;
color: black;
}
#ul_body > li:hover > div {
display:block;
}
ul.imgchange {
list-style:none;
padding:0;
margin:0;
}
ul.imgchange li {
cursor:pointer;
text-decoration: underline;
}
.onebyone > img{
width:100px;
height:100px;
padding:0;
}
.multi_content {
list-style:none;
padding:0;
}
.multi_content>li {
float: left;
padding:2px;
}
/* Content below the links */
#content {
clear:both;
border-top:1px solid black;
background-color:blue;
border-bottom:1px solid black;
}
.main {
width: 80%;
margin: auto;
height:300px;
background-color: white;
border-left:1px solid grey;
border-right: 1px solid grey;
}
</style>
<script type="text/javascript">
function change_image(the_id,the_image){
x = document.getElementById(the_id);
x.innerHTML = '<img src="'+the_image+'" />';
}
</script>
</head>
<body>
<div id="nav">
<ul id="ul_body">
<li>Link One<div>
<ul class="multi_content"><li><div id="img1" class="onebyone">
<img src="http://industrial-supplies.biz/images/s-i/C48AS.jpg" />
</div>
<ul class="imgchange">
<li onmouseover="change_image('img1','http://www.clker.com/cliparts/7/H/K/N/L/g/crossed-hammers-bw-100x100-md.png')">Image One</li>
<li onmouseover="change_image('img1','http://industrial-supplies.biz/images/s-i/C48AS.jpg')">Image Two</li>
</ul></li>
<li><div id="img2" class="onebyone">
<img src="http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX18_3.jpg" />
</div>
<ul class="imgchange">
<li onmouseover="change_image('img2','http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX18_3.jpg')">Image One</li>
<li onmouseover="change_image('img2','http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX20_2.jpg')">Image Two</li>
</ul></li></ul>
</div>
</li>
<li>Link Two<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Three<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Four<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sapien nisl, convallis sed vulputate at, pharetra ut tortor. Duis sagittis id eros in pretium. Duis vel fermentum orci, ac ornare nisl. Praesent lorem lacus, aliquam sit amet ante quis, tincidunt rhoncus tellus. Cras lobortis sit amet lacus ut mattis. Vestibulum non risus diam. Praesent quis nunc eu nisi fermentum accumsan. Nam eu tempus eros, molestie sollicitudin sapien. Aliquam erat volutpat. Vivamus felis risus, eleifend et feugiat quis, egestas ac mi.</div></li>
<li>Link Five<div>Lorem ipsum dolor sit amet</div></li>
</ul>
</div>
<div id="content">
<div class="main">
Content goes here
</div>
</div>
</body>
</html>
Explains how you can edit it:
Red font color means you have to add it
Visible tabs non-hovered:
#ul_body > li{
border: 1px solid black; /* Change border color on top tabs */
float:left;
margin-left: 5px; /* Sets the space between each of the tabs */
padding: 2px 5px;
border-radius: 5px 5px 0 0;
border-bottom:none;
background-color: green; /* Change background color on non-hover background tabs */
}
Visible tabs once you hover of them:
#ul_body > li:hover{
background-color: black; /*changes background color */
color:white; /*changes font color */
cursor:pointer;
border-color: 1px solid green; /*changes the color of the border */
}
The hover content:
#ul_body > li > div {
display:none;
margin:auto;
position:absolute;
background-color:white; /* Changes background color */
border:1px solid black; /*changes border color */
margin-top:1px;
border-radius:10px;
margin-left: -20px;
padding: 3px;
max-width:70%;
cursor: default;
min-width: 200px;
text-align: center;
color: black; /*Color inside the div */
}
Image change links:
ul.imgchange li {
cursor:pointer;
text-decoration: underline;
color: red; /* changes the color text */
}
Change color when hovered over change image links:
ul.imgchange li:hover{
text-decoration: none;
color: green; /*changes the font color again */
}
To get the effect of having content next to each other add this:
<ul class="multi_content"><li>Content</li><li>Content</li></ul>
The red is showing where it has been added to the code at the top; so it has already been added.
as seen here:
<ul class="multi_content"><li><div id="img1" class="onebyone">
<img src="http://industrial-supplies.biz/images/s-i/C48AS.jpg" />
</div>
<ul class="imgchange">
<li onmouseover="change_image('img1','http://www.clker.com/cliparts/7/H/K/N/L/g/crossed-hammers-bw-100x100-md.png')">Image One</li>
<li onmouseover="change_image('img1','http://industrial-supplies.biz/images/s-i/C48AS.jpg')">Image Two</li>
</ul></li>
<li><div id="img2" class="onebyone">
<img src="http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX18_3.jpg" />
</div>
<ul class="imgchange">
<li onmouseover="change_image('img2','http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX18_3.jpg')">Image One</li>
<li onmouseover="change_image('img2','http://media.sdfirealarms.co.uk/media/catalog/product/cache/6/image/500x500/fbcb73186cd05db6dad7b3600e4e2dc4/F/E/FEX20_2.jpg')">Image Two</li>
</ul></li></ul>
molendijk
09-25-2013, 08:53 PM
Both the samsung menu and the kathmandu menu have a serious issue. To see this, go to their sites, resize the window until a horizontal scrollbar appears, then move the mouse over a (main) menu item. The result is a big submenu item that is not entirely visible since the window is small. Now you would think that you could see the rest of the subitem by using the horizontal scrollbar. But as soon as your mouse gets there, the submenu disappears. So you never see the whole submenu item with a smaller window.
Design: ok, functionality: bad, very bad (think of mobile device users).
(I haven't checked the menu proposed by Crazykld69, so I don't know if his (her?) menu has the same issue).
Deadweight
09-25-2013, 10:48 PM
Dont know how it will look on mobile devices; however, i could make a mobile section. Mine (on a smaller screen excluding mobile) should be 70% of the width (unless it under 200px). Should work fine and not appear off the page. That is a should. If there are any problems let me know with this issue.
james438
09-26-2013, 04:16 AM
Dont know how it will look on mobile devices; however, i could make a mobile section. Mine (on a smaller screen excluding mobile) should be 70% of the width (unless it under 200px). Should work fine and not appear off the page. That is a should. If there are any problems let me know with this issue.
Could you elaborate on this a bit more. I'm not fully understanding what you are saying here.
Deadweight
09-26-2013, 04:21 AM
Meaning i dont know how it, the menu, will look in mobile view.
Also if you shrink the screen down the div menu should appear off the page unless the width of the website is smaller than 200px.
If there are problems with it (the op) then s/he may ask me.
james438
09-26-2013, 04:24 AM
Ah, thanks for explaining.
molendijk
09-26-2013, 09:21 AM
Crazykld69, I tried the code you posted in # 6. It has the same issue as the samsug and kathmandu for certain links in a very small window (240 px, 320px). You could deal with the image(s) by sizing it/them with percentages. As for text blocks (that open after the mouse hovers over a link), see this code (http://mesdomaines.nu/eendracht/scalable_text3/scalable_text.html) and this blog (http://www.dynamicdrive.com/forums/entry.php?279-Viewing-your-site-in-Responsive-Design-Mode).
Bornfree
10-10-2013, 03:34 AM
Hi Guys,
I just need a little help. The text in the menu, i need it to be in the middle of the menu background image. (vertical align-centre). I cannot seem to figure that out. Can you please help me? Here is the link to my test page. http://www.elsema.com/menutest1.html
jscheuer1
10-10-2013, 05:20 AM
Around line 121 in elsema.com/cs/global.css:
#ul_menu1 > li{
float:left;
height:35px;
z-index:999;
margin-left: 1px; /* Sets the space between each of the tabs */
padding:7px 30px 0px 30px;
background:url(../images/menubdr.jpg) right top no-repeat;
}
Make the change (red) in the highlighted line.
And, if the gap between the headers and the drop downs bothers you (I think it looks good), around line 145:
#ul_menu1 > li > div {
display:none;
margin:auto;
position:absolute;
z-index:999;
background-color:#012e56; /* Changes background color */
border:1px solid black; /*changes border color */
margin-top:10px;
border-radius:10px;
margin-left: -20px;
padding: 3px;
max-width:100%;
cursor: default;
min-width: 200px;
text-align: center;
color: black; /*Color inside the div */
}
The browser cache may need to be cleared and/or the page refreshed to see changes.
Bornfree
10-10-2013, 10:30 PM
OMG, So easy. Thank you once again jscheuer1. Just another small issue. If you look closly, in the dropdown menu there is a small black dot in the top right hand corner. Can't seem to get rid og that. I guess its in the code somewhere.
Bornfree
10-10-2013, 10:32 PM
Oops! found the mistake. Got it sorted. Thank you for all the help.
Bornfree
10-11-2013, 01:22 AM
Ok i have another glitch. When mouseover the menu, the dropdown starts from the position of the menu on which you have your mouse, so when i go to the one on the right hand side, the dropdown gets vertical. Can i have it so that it always horizontal and move to the left if there is not enought room on the right? If you see this page http://www.elsema.com/menutest1.html and take mouse over the menu on the right you will see it.
jscheuer1
10-11-2013, 04:44 AM
Unless I misunderstand, that's not a glitch. I believe that's the default layout for the menu. To get what I think you're saying you want, again in the global.css file, this time around line 140, add the two highlighted lines:
#ul_menu1 > li > div {
display:none;
margin:auto;
position:absolute;
z-index:999;
background-color:#012e56; /* Changes background color */
border:1px solid black; /*changes border color */
margin-top:10px;
border-radius:10px;
left: 30px;
margin-left: -30px;
margin-right: 0px;
padding: 3px;
max-width:100%;
cursor: default;
min-width: 200px;
text-align: center;
width: 953px;
color: black; /*Color inside the div */
}
Bornfree
10-14-2013, 09:52 PM
Thanks jscheuer1. The menu seems to stick to the left. Can it be made so that it appears on the center of the menu (whichever the mouse is on)? Please have a look at menu two. The right side comes in. It looks funny. Can it be that the whole dropdown is centered but still within the page width.
Also on menu two and menu three the image does not change on mouseover. Where am i missing the code?
jscheuer1
10-15-2013, 06:25 AM
That might take a little time to work out. I thought you just wanted them all left aligned.
Anyways, the reason the rollover only works on the first one is that there can only be one element with an id of img1 on the page. If you have more than one the code will either throw an error (older browsers) or pick the first one and use that. The latter must be what's happening. The rollover is working but the image that's changing cannot be seen. I just tested it and I can control the images on Menu One from Menu Two.
Each div whose image that you're changing must have it's own unique id and be referenced as such in the rollover events.
Like, on Menu Two you could have img1a, img2a, ect.
Bornfree
10-23-2013, 05:32 AM
Hi Guys,
I know am opening a can of worms here but i need to combine 2 different scripts (i think it what its called.) Here we go, I only need the menu style of "Products" from this page http://www.elsema.com/menutest1.html Combined with the menu's on this page http://www.elsema.com/. I have managed to get the position and the colors matching.
In other words everything remains the same expect for the products menu.
Thank in advance
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.