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
|
18 | var zeynep = $('.zeynep').zeynep({
|
19 | load: function (element, options) {
|
20 | console.log('zeynepjs menu is successfully loaded')
|
21 | }
|
22 | })
|
23 |
|
24 | // opens the menu
|
25 | zeynep.open()
|
26 |
|
27 | // closes the menu
|
28 | zeynep.close()
|
29 |
|
30 | // dynamically event binding
|
31 | zeynep.on('closing', function () {
|
32 | console.log('guys, the side menu is closing')
|
33 | })
|
34 |
|
35 | // destroys the menu
|
36 | zeynep.destroy()
|
37 | ```
|
38 |
|
39 | ## Using with Webpack
|
40 | Once the library installed in your project, just import it:
|
41 |
|
42 | ```js
|
43 | import 'zeynepjs'
|
44 | ```
|
45 |
|
46 | ## Events
|
47 |
|
48 | > Events can also be defined in options.
|
49 |
|
50 | ### `loading(element, options)`
|
51 |
|
52 | Fired 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 |
|
60 | Fired 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 |
|
68 | Fired 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 |
|
78 | Fired 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 |
|
88 | Fired 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 |
|
98 | Fired 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 |
|
108 | Fired 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 |
|
116 | Fired 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
|
123 | Contributions and pull requests are kindly welcomed!
|
124 |
|
125 | ## License
|
126 | This project is licensed under the terms of the [MIT license](https://github.com/hsynlms/zeynepjs/blob/master/LICENSE).
|