|
1 | 1 | ## Dropdown menu |
2 | 2 |
|
3 | 3 | Simple dropdown menu. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +``` |
| 8 | +npm install --save css-ui-dropdown-menu |
| 9 | +``` |
| 10 | + |
| 11 | +## Demo |
| 12 | + |
| 13 | +- https://css-ui.github.io/dropdown.menu |
| 14 | + |
| 15 | +## Quick start |
| 16 | + |
| 17 | +CSS dependencies. |
| 18 | + |
| 19 | +```html |
| 20 | +<link rel="stylesheet" href="path/to/normalize.css"> |
| 21 | +<link rel="stylesheet" href="path/to/font-awesome.css"> |
| 22 | +<link rel="stylesheet" href="path/to/open-sans.css"> |
| 23 | +<link rel="stylesheet" href="path/to/cssui.css"> |
| 24 | +``` |
| 25 | + |
| 26 | +CSS dropdown style. |
| 27 | + |
| 28 | +```html |
| 29 | +<link rel="stylesheet" href="path/to/style.dropdown.css"> |
| 30 | +``` |
| 31 | + |
| 32 | +CSS light or dark theme for menu. Choose one. |
| 33 | + |
| 34 | +```html |
| 35 | +<link rel="stylesheet" href="path/to/style.dropdown.light.css"> |
| 36 | +<link rel="stylesheet" href="path/to/style.dropdown.dark.css"> |
| 37 | +``` |
| 38 | + |
| 39 | +Set font. |
| 40 | + |
| 41 | +```html |
| 42 | +<style> |
| 43 | + body { |
| 44 | + font-family: 'Open Sans', sans-serif; |
| 45 | + } |
| 46 | +</style> |
| 47 | +``` |
| 48 | + |
| 49 | +Dropdown menu html. |
| 50 | + |
| 51 | +```html |
| 52 | +<div class="dropdown"> |
| 53 | + |
| 54 | + <!-- dropdown menu click --> |
| 55 | + <div class="clear"> |
| 56 | + <a class="employ-toggle click float right" href="#"> |
| 57 | + <i class="fa fa-ellipsis-v" aria-hidden="true"></i> |
| 58 | + </a> |
| 59 | + </div> |
| 60 | + |
| 61 | + <!-- show/hide menu --> |
| 62 | + <ul class="expand-dropdown"> |
| 63 | + <li><a href="#" class="top">One</a></li> |
| 64 | + <li><a href="#">Two</a></li> |
| 65 | + <li><a href="#" class="bottom">Three</a></li> |
| 66 | + </ul> |
| 67 | +</div> |
| 68 | +``` |
| 69 | + |
| 70 | +javascript libraries and plugins. |
| 71 | + |
| 72 | +```html |
| 73 | +<script src="path/to/jquery.js"></script> |
| 74 | +<script> |
| 75 | + $(function() { |
| 76 | + $('.employ-toggle').on('click', function() { |
| 77 | + var dropdown = '.expand-dropdown'; |
| 78 | + $(dropdown).fadeToggle('fast'); |
| 79 | + $(dropdown).on('click', function(e) { |
| 80 | + var target = e.target; |
| 81 | + var employ = '.employ-toggle'; |
| 82 | + if (!$(target).is(employ) && !$(target).parents().is(employ)) { |
| 83 | + $(dropdown).hide(); |
| 84 | + } |
| 85 | + }); |
| 86 | + }); |
| 87 | + }); |
| 88 | +</script> |
| 89 | +``` |
0 commit comments