?
Solved

Drop Down Menu

Posted on 2014-08-24
3
Medium Priority
?
237 Views
Last Modified: 2014-08-24
I have a 3 Line icon on a webpage that is to be a drop down menu.  It's wacky right now as I have a button but I need it to work of the CSS image.  How can I do this?

The Javascript
<script>
		$(function () {
    $("#button").click(function () {
        $("#lines").slideToggle()
    })
})
</script>

Open in new window


The CSS
#lines { 
   position: fixed;
   top: 20px;
   right: 30px;
  height: 5px;  
   width:30px;
border-bottom: 17px double white; 
    border-top: 6px solid white; 
    content:"";
   	}

Open in new window



The HTML
<input type="button" id="button" value="Click Me">
    <div id="lines">
    A Menu <br>
    A Menu <br>
    A Menu <br>
    A Menu <br>
    </div>

Open in new window


Not sure if this is the way or if there is a better way.  Thank you.
0
Comment
Question by:DS928
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40282205
Wrap your code like this
<div class="wrapper">
	<div style="display: block;" id="lines"></div>
  <div>
    A Menu <br>
    A Menu <br>
    A Menu <br>
    A Menu <br>
  </div>
</div>

Open in new window

Remove the button
Change your jquery to
$(function () {
    $("#lines").click(function () {
        $(this).next("div").slideToggle()
    })
})

Open in new window

0
 

Author Closing Comment

by:DS928
ID: 40282213
Thank you Gary.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40282214
...and set the position on the wrapper div, not the lines div
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question