priority-nav 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +106 -96
- package/demo/css/main.css +155 -155
- package/demo/css/priority-nav-core.css +38 -38
- package/demo/images/src/svg/arrow-down.svg +11 -11
- package/demo/images/src/svg/github-mark.svg +11 -11
- package/demo/images/src/svg/knob.svg +19 -19
- package/demo/index.html +143 -143
- package/demo/js/classList.js +69 -69
- package/demo/js/html5shiv.min.js +3 -3
- package/demo/js/priority-nav.js +666 -666
- package/demo/scss/base/_base.scss +13 -13
- package/demo/scss/base/_boxsizing.scss +13 -13
- package/demo/scss/base/_typography.scss +37 -37
- package/demo/scss/components/_github-links.scss +11 -11
- package/demo/scss/components/_logo.scss +14 -14
- package/demo/scss/components/_nav.scss +118 -118
- package/demo/scss/components/_social.scss +8 -8
- package/demo/scss/layouts/_header.scss +20 -20
- package/demo/scss/main.scss +42 -42
- package/demo/scss/pages/_home.scss +29 -29
- package/demo/scss/utils/_easings.scss +38 -38
- package/demo/scss/utils/_helpers.scss +92 -92
- package/demo/scss/utils/_triangles.scss +26 -26
- package/demo/scss/utils/_variables.scss +29 -29
- package/demo/scss/vendors/_normalize.scss +424 -424
- package/dist/priority-nav-core.css +9 -9
- package/dist/priority-nav.js +719 -724
- package/dist/priority-nav.min.js +3 -2
- package/package.json +46 -46
package/LICENSE
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Gijs Rogé
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
22
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Gijs Rogé
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
package/README.md
CHANGED
@@ -1,96 +1,106 @@
|
|
1
|
-
# PriorityNavigation.js
|
2
|
-
PriorityNav is a
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
- **
|
13
|
-
- **
|
14
|
-
- **
|
15
|
-
- **
|
16
|
-
- **
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
```
|
36
|
-
|
37
|
-
```
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
<li>menu item</li>
|
43
|
-
<li>menu item</li>
|
44
|
-
|
45
|
-
</
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
//
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
```
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
```
|
1
|
+
# PriorityNavigation.js
|
2
|
+
PriorityNav is a pure javascript plugin that will move your menu items if they don't fit its parent.
|
3
|
+
#### Vue.js version **[here](https://github.com/gijsroge/vue-responsive-menu)**.
|
4
|
+
----------
|
5
|
+

|
6
|
+
|
7
|
+
#### Take a look at the **[Demo](http://gijsroge.github.io/priority-nav.js/)** site.
|
8
|
+
|
9
|
+
----------
|
10
|
+
|
11
|
+
### Features
|
12
|
+
- **Accessible**<br>Adds appropriate aria attributes and set focus to links when needed.
|
13
|
+
- **No dependencies**<br>The plugin is written in pure javascript making it fast and lean.
|
14
|
+
- **Breakpoint**<br>When the breakpoint has been reached the plugin will automaticly move all items to the dropdown & change the toggle label to navDropdownBreakpointLabel.
|
15
|
+
- **Smart calculation of available space**<br>It automatically looks for the main navigation's siblings and calculates remaining space.
|
16
|
+
- **Flexible**<br>Because of the point above you can have multiple inline-block/flexbox items on the same level.
|
17
|
+
- **Non obstructive menu dropdown**<br>The dropdown menu can be closed by clicking outside and pressing escape.
|
18
|
+
- **Callbacks**<br>Callbacks are fired when an item is moved or moved back from the main navigation.
|
19
|
+
|
20
|
+
### Usage
|
21
|
+
Load plugin files
|
22
|
+
|
23
|
+
```html
|
24
|
+
<!DOCTYPE html>
|
25
|
+
<head>
|
26
|
+
<link rel="stylesheet" href="priority-nav-core.css">
|
27
|
+
</head>
|
28
|
+
|
29
|
+
<body>
|
30
|
+
<script async src="priority-nav.js"></script>
|
31
|
+
</body>
|
32
|
+
```
|
33
|
+
|
34
|
+
Call plugin without any options.
|
35
|
+
```js
|
36
|
+
var nav = priorityNav.init();
|
37
|
+
```
|
38
|
+
Ideal html structure
|
39
|
+
```html
|
40
|
+
<nav>
|
41
|
+
<ul> <- needs to be inline-block
|
42
|
+
<li>menu item</li>
|
43
|
+
<li>menu item</li>
|
44
|
+
<li>menu item</li>
|
45
|
+
<li>menu item</li>
|
46
|
+
</ul>
|
47
|
+
</nav>
|
48
|
+
```
|
49
|
+
|
50
|
+
### Options
|
51
|
+
```js
|
52
|
+
initClass: "js-priorityNav", // Class that will be printed on html element to allow conditional css styling.
|
53
|
+
mainNavWrapper: "nav", // mainnav wrapper selector (must be direct parent from mainNav)
|
54
|
+
mainNav: "ul", // mainnav selector. (must be inline-block)
|
55
|
+
navDropdownClassName: "nav__dropdown", // class used for the dropdown - this is a class name, not a selector.
|
56
|
+
navDropdownToggleClassName: "nav__dropdown-toggle", // class used for the dropdown toggle - this is a class name, not a selector.
|
57
|
+
navDropdownLabel: "more", // Text that is used for the dropdown toggle.
|
58
|
+
navDropdownBreakpointLabel: "menu", //button label for navDropdownToggle when the breakPoint is reached.
|
59
|
+
breakPoint: 500, //amount of pixels when all menu items should be moved to dropdown to simulate a mobile menu
|
60
|
+
throttleDelay: 50, // this will throttle the calculating logic on resize because i'm a responsible dev.
|
61
|
+
offsetPixels: 0, // increase to decrease the time it takes to move an item.
|
62
|
+
count: true, // prints the amount of items are moved to the attribute data-count to style with css counter.
|
63
|
+
|
64
|
+
//Callbacks
|
65
|
+
moved: function () {}, // executed when item is moved to dropdown
|
66
|
+
movedBack: function () {} // executed when item is moved back to main menu
|
67
|
+
```
|
68
|
+
|
69
|
+
### Package managers
|
70
|
+
- **npm:** `npm install --save priority-nav`
|
71
|
+
- **bower:** `bower install priority-nav.js`
|
72
|
+
|
73
|
+
### Building the source files
|
74
|
+
```
|
75
|
+
#cloning repository
|
76
|
+
git clone https://github.com/gijsroge/priority-navigation.git
|
77
|
+
cd priority-navigation
|
78
|
+
|
79
|
+
#dependencies
|
80
|
+
npm install
|
81
|
+
|
82
|
+
#build files to dist folder
|
83
|
+
grunt build
|
84
|
+
```
|
85
|
+
|
86
|
+
### IE9 Support
|
87
|
+
To support Internet Explorer 9 and lower [classList.js](https://github.com/remy/polyfills/blob/master/classList.js/) must be added your page.
|
88
|
+
|
89
|
+
```html
|
90
|
+
<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/2014.01.31/classList.min.js"></script><![endif]-->
|
91
|
+
```
|
92
|
+
|
93
|
+
### IE8 Support
|
94
|
+
To support Internet Explorer 8, [es5-shim](https://github.com/kriskowal/es5-shim/) and classList.js from above must be added your page.
|
95
|
+
|
96
|
+
```html
|
97
|
+
<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.0.8/es5-shim.min.js"></script><![endif]-->
|
98
|
+
```
|
99
|
+
|
100
|
+
### Alternatives
|
101
|
+
* https://github.com/lewie6/ng-priority-nav (angular)
|
102
|
+
* https://github.com/matthornsby/priority-navigation (jQuery)
|
103
|
+
* https://github.com/352Media/flexMenu (jQuery)
|
104
|
+
* https://github.com/VPenkov/okayNav (jQuery)
|
105
|
+
* https://github.com/VPenkov/okayNav-vanillaJS (no dependencies)
|
106
|
+
* https://github.com/skywalkapps/nav-priority (no dependencies)
|