Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 5, 2019. It is now read-only.

Commit 0e6a66b

Browse files
committed
JS moved to an external file.
1 parent e1e7ccf commit 0e6a66b

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

‎js/dropdown.menu.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
/*
3+
* Dropdown menu.
4+
*/
5+
(function($) {
6+
7+
var dropdown = '.expand-dropdown';
8+
var employ = '.employ-toggle';
9+
10+
$(employ).on('click', function() {
11+
$(dropdown).fadeToggle('fast');
12+
$(dropdown).on('click', function(e) {
13+
if (!$(e.target).is(employ) && !$(e.target).parents().is(employ)) {
14+
$(dropdown).hide();
15+
}
16+
});
17+
});
18+
19+
}(jQuery));

‎package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-ui-dropdown-menu",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Simple dropdown menu.",
55
"main": "css/style.dropdown.css",
66
"repository": {
@@ -16,7 +16,7 @@
1616
"url": "https://github.com/css-ui/dropdown-menu/issues"
1717
},
1818
"dependencies": {
19-
"css-ui-simple": "^2.5.1",
19+
"css-ui-simple": "^2.5.2",
2020
"open-sans-fontface": "^1.4.0",
2121
"jquery": "^3.3.1",
2222
"font-awesome": "^4.7.0"

‎readme.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,6 @@ javascript libraries and plugins.
6868

6969
```html
7070
<script src="path/to/jquery.js"></script>
71-
<script>
72-
$(function() {
73-
$('.employ-toggle').on('click', function() {
74-
var dropdown = '.expand-dropdown';
75-
$(dropdown).fadeToggle('fast');
76-
$(dropdown).on('click', function(e) {
77-
var target = e.target;
78-
var employ = '.employ-toggle';
79-
if (!$(target).is(employ) && !$(target).parents().is(employ)) {
80-
$(dropdown).hide();
81-
}
82-
});
83-
});
84-
});
85-
</script>
71+
<script src="path/to/dropdown.menu.js"></script>
8672
```
8773
Enjoy dropdown menu.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /