1
- # Navbar - minimal navigation script
2
- This is a script that most web developers need for a quick site navigation, built with Native Javascript and supported on all major browsers as well as legacy browsers starting with IE8 .
1
+ # Navbar.js - Modern Navigation Component
2
+ The mobile first menu navigation for today's modern web, developed with native JavaScript and packed with lots of features .
3
3
4
4
[ ![ NPM Version] ( https://img.shields.io/npm/v/navbar.js.svg?style=flat-square )] ( https://www.npmjs.com/package/navbar.js )
5
5
[ ![ NPM Downloads] ( https://img.shields.io/npm/dm/navbar.js.svg?style=flat-square )] ( http://npm-stat.com/charts.html?package=navbar.js )
6
6
[ ![ jsDeliver] ( https://data.jsdelivr.com/v1/package/npm/navbar.js/badge )] ( https://www.jsdelivr.com/package/npm/navbar.js )
7
7
8
+ [ ![ NAVBAR Preview] ( ./demo/assets/img/navbar.png )] ( ./demo/assets/img/navbar.png )
9
+
8
10
# Demo
9
11
Download the package and check the demo folder, or check it online [ here] ( http://thednp.github.io/navbar.js/ ) .
10
12
11
-
12
- # Features
13
- * opens submenus on mouseenter, by adding ` open ` and ` open-position ` classes to the menu item, in rapid succession</li >
14
- * hides submenus on mouseleave, by removing the above classes in a delayed succesion</li >
15
- * super light script, ` 1.2k ` in size when minified
16
- * responsive design ready
17
- * super light and easy to customize CSS
13
+ # Navbar.js Highlights
14
+ * Mobile First Design
15
+ * ES6/ES7 sources and powerful build tools
16
+ * SCSS sources with powerful mixins and advanced inheritance and automation functionality
17
+ * very light footprint, ` 3kb ` in size when minified
18
18
* 3 sets of positions top (main), left or right
19
- * animations are based on position
20
- * LESS/SCSS sources ready
19
+ * provides a set of options for JavaScript initialization
21
20
* DATA API allows you to automatically initiate without JS invocation
22
- * cross- browser supported
21
+ * modern browser supported and semi-modern alike with a special polyfill for IE10+ provided
23
22
24
- # NPM/Bower
25
- You can install this through NPM or bower respectively:
23
+ # How It Works
24
+ * opens submenus on ` mouseenter ` , by adding ` open ` and ` open-position ` classes to the menu item, in rapid succession</li >
25
+ * hides submenus on ` mouseleave ` , by removing the above classes in a delayed succesion</li >
26
+ * on mobile devices it makes use of the ` open-mobile ` class to toggle submenus and a ` click ` handler associated</li >
27
+
28
+ # NPM
29
+ You can install this through NPM:
26
30
27
31
```
28
32
$ npm install navbar.js
29
- # or
30
- $ bower install navbar.js
31
33
```
32
34
33
35
# Browser Usage
@@ -37,7 +39,7 @@ Link the required CSS in your document `<head>` tag
37
39
<link href =" ../assets/css/navbar.css" rel =" stylesheet" >
38
40
```
39
41
40
- Link the required JS in your document ` <body> ` tag
42
+ Link the required JS in your document ` <body> ` tag, though it should work in the ` <head> ` as well
41
43
``` html
42
44
<script src =" ../assets/js/navbar.js" ></script >
43
45
```
@@ -56,8 +58,8 @@ To use the DATA-API, you need to provide the `data-function="navbar"` attribute
56
58
<li><a href="#">Another Link Title</a></li>
57
59
</ul>
58
60
```
61
+ Other initialization options apply, explained in the demo.
59
62
60
- Legacy browsers need ` classList ` polyfill, so give them <a href =" https://github.com/thednp/minifill " >minifill</a >.
61
63
62
64
# Node
63
65
On node.js environments
@@ -72,9 +74,19 @@ var myMenu = new Navbar('selector');
72
74
# Build Tools
73
75
You have 3 build tools for building custom builds
74
76
75
- * ` $ npm run min-js ` - to minify the ** navbar.js**
76
- * ` $ npm run build-less ` - to compile and minify the ** navbar.less**
77
- * ` $ npm run build-scss ` - to compile and minify the ** navbar.scss**
77
+ * ` $ npm run build ` - to compile and minify the ES6/ES7 source ** navbar.js** and ** navbar.min.js**
78
+ * ` $ npm run compile ` - to compile and minify the ** navbar.less** and other demo related sources
79
+ * ` $ npm run bundle ` - to execute both the above in paralel
80
+
81
+ # Custom CSS Builds
82
+ You can create your own custom styling, here's a quickie:
83
+ * create a new file for instance ` src/scss/my-navbar.scss ` ,
84
+ * include the mixins and variables' values you need (check out the demos for more)
85
+ * run the below script
86
+
87
+ ```
88
+ node compile.js INPUTFILE:src/scss/my-navbar.scss OUTPUTFILE:path-to/src/css/my-navbar.min.css MIN:true
89
+ ```
78
90
79
91
# License
80
92
[ MIT License] ( https://github.com/thednp/navbar.js/blob/master/LICENSE )
0 commit comments