troubleshooting Question

Create Drop Down Menu on Website

Avatar of WO2015
WO2015 asked on
8 Comments1 Solution205 ViewsLast Modified:

I had a ticket out to add a drop down menu to my website. The code I received worked. The problem now when I go to add items to another link, it does not work on that link. I am looking for a simple way to have drop down's on my menu. Below is what I have in place now which works but only for 1 link.


<nav class="menu">
<ul id="menu">
  <li><a href="#!/page_Evangelos">Evangelos</a></li>
  <li><a href="#!/page_Services">Features</a></li>
  <li><a href="#!/page_Gallery">Gallery</a>
       <a href="#!/page_Subvices">Sub&nbsp;tures</a><br />
       <a href="#!/page_Subvik">Sub&nbsp;vings</a><br />
       <a href="#!/page_Subart">Sub&nbsp;antine&nbsp;Art</a>
  <li><a href="#!/page_Carvings">Byzantine Art</a></li>
  <li><a href="#!/page_Carvings">Sculptures</a></li>
  <li><a href="#!/page_Carvings">Carvings</a></li>
  <li><a href="#!/page_Contacts">Contacts</a></li>

.menu { float:right; padding-top:36px;}
#menu > li { float:left; margin-left:30px; position:relative;}
#menu > li div{
display: none;
text-align: center;
position: absolute;
left: -20px;
background: #ccc;
padding: 3px;
border-radius: 8px
#menu > li > a{/* display:block;*/ font:17px 'Asap', sans-serif; color:#fff; text-shadow:1px 1px rgba(0,0,0,.5);}
#menu > li > a:hover, #menu > .active > a{background: blue; }

var lis = document.getElementById("menu").getElementsByTagName("li");
lis[2].children[0].onclick = function (event) { // the index 2 is the Gallery

var div1 = this.parentElement.getElementsByTagName("div")[0];
if ( == "inline-block") = "none";
else = "inline-block";


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros