Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dmitriyakkerman/nav-menu-js

Javascript navigation module for your website, which gives you possibility to get rid of routine.
https://github.com/dmitriyakkerman/nav-menu-js

javascript menu multiple-level-menu nav navigation

Last synced: 3 days ago
JSON representation

Javascript navigation module for your website, which gives you possibility to get rid of routine.

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/dmitriyakkerman/nav-menu-js.svg?branch=master)](https://travis-ci.org/github/dmitriyakkerman/nav-menu-js)

Javascript navigation module(includes links "click" and "mouseover" events)" for your website, which gives you possibility to get rid of routine.

**Example:**

https://codepen.io/mickyholbrook/pen/GRjqwJj

**Installation:**

***npm***

npm i nav-menu-js

Load the required JS to your entry JS file:
```js
let NavMenu = require('nav-menu-js');
or
import NavMenu from 'nav-menu-js';
```
Load the required stylesheet to your entry CSS file:
```css
@import "node_modules/nav-menu-js/index";
```
***Cloning git repository***

1. Go to your project directory
2. git clone https://github.com/dmitriyakkerman/nav-menu-js.git .

Put the required stylesheet link in HEAD tag:
```html

```
Put the module script at the bottom of your markup:
```html

```
**Usage**

Create typical navigation structure with nested lists.
```html


```
**Initialization**

1. Specify root selector(string or DOM node) in "nav" option.
2. Specify "preventParentClick" option for preventing click event on parent links which have child elements("false" by default).

Initialization with script tag
```js

document.addEventListener('DOMContentLoaded', function () {
new NavMenu({
nav: '.header-nav',
preventParentClick: true
});
});

```
or

Initialization by creating [filename].js file and connecting in a script tag
```js
// init.js

document.addEventListener('DOMContentLoaded', function () {
new NavMenu({
nav: '.header-nav',
preventParentClick: true
});
});

```