UNPKG

3.74 kBMarkdownView Raw
1# zeynepjs
2> A lightweight multi-level jQuery side menu plugin.
3
4[![NPM](https://nodei.co/npm/zeynepjs.png)](https://nodei.co/npm/zeynepjs/)
5
6`zeynepjs` is a light-weight multi-level jQuery side menu plugin. It's fully customizable and is compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer.
7
8## Options
9
10| Option | Type | Default | Description |
11| --- | --- | --- | --- |
12| htmlClass | boolean | true | If `true` zeynepjs will add some classes to `<html/>` element like `zeynep-initialized`, `zeynep-opened` |
13
14## Usage
15
16```js
17// initialize zeynepjs and get the instance into a variable
18var zeynep = $('.zeynep').zeynep({
19 load: function (element, options) {
20 console.log('zeynepjs menu is successfully loaded')
21 }
22})
23
24// opens the menu
25zeynep.open()
26
27// closes the menu
28zeynep.close()
29
30// dynamically event binding
31zeynep.on('closing', function () {
32 console.log('guys, the side menu is closing')
33})
34
35// destroys the menu
36zeynep.destroy()
37```
38
39## Using with Webpack
40Once the library installed in your project, just import it:
41
42```js
43import 'zeynepjs'
44```
45
46## Events
47
48> Events can also be defined in options.
49
50### `loading(element, options)`
51
52Fired when the menu is being loaded. This event cannot be defined dynamically. It needs to be defined in options.
53
54`element` is the element that zeynepjs is being loaded on.
55
56`options` is the initialized zeynepjs instance options.
57
58### `load(element, options)`
59
60Fired when the menu is loaded. This event cannot be defined dynamically. It needs to be defined in options.
61
62`element` is the element that zeynepjs has been loaded on.
63
64`options` is the initialized zeynepjs instance options.
65
66### `opening(element, options, details)`
67
68Fired when the menu or a sub-menu is being opened.
69
70`element` is the zeynepjs instance element.
71
72`options` is the initialized zeynepjs instance options.
73
74`details` contains a flag which indicates the item that is being opened is the menu or a sub-menu and the sub-menu DOM Element ID.
75
76### `opened(element, options, details)`
77
78Fired when the menu or a sub-menu is opened.
79
80`element` is the zeynepjs instance element.
81
82`options` is the initialized zeynepjs instance options.
83
84`details` contains a flag which indicates the opened item is the menu or a sub-menu and the opened sub-menu DOM Element ID.
85
86### `closing(element, options, details)`
87
88Fired when the menu or a sub-menu is being closed.
89
90`element` is the zeynepjs instance element.
91
92`options` is the initialized zeynepjs instance options.
93
94`details` contains a flag which indicates the item that is being closing is the menu or a sub-menu and the sub-menu DOM Element ID.
95
96### `closed(element, options, details)`
97
98Fired when the menu or a sub-menu is closed.
99
100`element` is the zeynepjs instance element.
101
102`options` is the initialized zeynepjs instance options.
103
104`details` contains a flag which indicates the closed item is the menu or a sub-menu and the closed sub-menu DOM Element ID.
105
106### `destroying(element, options)`
107
108Fired when the menu is being destroyed.
109
110`element` is the zeynepjs instance element.
111
112`options` is the zeynepjs instance options that is being destroyed.
113
114### `destroyed(element, options)`
115
116Fired when the menu is destroyed.
117
118`element` is the destroyed zeynepjs instance element.
119
120`options` is the destroyed zeynepjs instance options.
121
122## Contribution
123Contributions and pull requests are kindly welcomed!
124
125## License
126This project is licensed under the terms of the [MIT license](https://github.com/hsynlms/zeynepjs/blob/master/LICENSE).