Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
JS moved to an external file.
Browse files Browse the repository at this point in the history
  • Loading branch information
accgit committed Jan 25, 2019
1 parent e1e7ccf commit 0e6a66b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
19 changes: 19 additions & 0 deletions js/dropdown.menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

/*
* Dropdown menu.
*/
(function($) {

var dropdown = '.expand-dropdown';
var employ = '.employ-toggle';

$(employ).on('click', function() {
$(dropdown).fadeToggle('fast');
$(dropdown).on('click', function(e) {
if (!$(e.target).is(employ) && !$(e.target).parents().is(employ)) {
$(dropdown).hide();
}
});
});

}(jQuery));
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "css-ui-dropdown-menu",
"version": "1.2.0",
"version": "1.2.1",
"description": "Simple dropdown menu.",
"main": "css/style.dropdown.css",
"repository": {
Expand All @@ -16,7 +16,7 @@
"url": "https://github.com/css-ui/dropdown-menu/issues"
},
"dependencies": {
"css-ui-simple": "^2.5.1",
"css-ui-simple": "^2.5.2",
"open-sans-fontface": "^1.4.0",
"jquery": "^3.3.1",
"font-awesome": "^4.7.0"
Expand Down
16 changes: 1 addition & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,6 @@ javascript libraries and plugins.

```html
<script src="path/to/jquery.js"></script>
<script>
$(function() {
$('.employ-toggle').on('click', function() {
var dropdown = '.expand-dropdown';
$(dropdown).fadeToggle('fast');
$(dropdown).on('click', function(e) {
var target = e.target;
var employ = '.employ-toggle';
if (!$(target).is(employ) && !$(target).parents().is(employ)) {
$(dropdown).hide();
}
});
});
});
</script>
<script src="path/to/dropdown.menu.js"></script>
```
Enjoy dropdown menu.

0 comments on commit 0e6a66b

Please sign in to comment.