Last active
December 13, 2015 20:08
-
-
Save tessalt/4968149 to your computer and use it in GitHub Desktop.
dropdowns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="dropdown"> | |
| <a href="#" class="dropdown-trigger">Trigger Dropdown</a> | |
| <ul class="dropdown-content"> | |
| <li><a href="#">Item 1</a></li> | |
| <li><a href="#">Item 2</a></li> | |
| </ul> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function dropdowns(){ | |
| $(".dropdown-trigger").click(function() { | |
| $(this).next(".dropdown-content").toggleClass("show"); | |
| return false; | |
| }); | |
| $("html").click(function() { | |
| $(".dropdown-content").removeClass("show"); | |
| }); | |
| $(".dropdown, .dropdown-trigger, .dropdown-content").click(function(event) { | |
| return event.stopPropagation(); | |
| }); | |
| } | |
| dropdowns(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .dropdown { | |
| position: relative; | |
| } | |
| .dropdown-content { | |
| display: none; | |
| position: absolute; | |
| list-style: none; | |
| z-index: 15; | |
| &.show { | |
| display: block; | |
| } | |
| a { | |
| display: block; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment