https://github.com/therolffr/customenu
Create custom context menus easily
https://github.com/therolffr/customenu
context-menu js js-plugin
Last synced: 10 months ago
JSON representation
Create custom context menus easily
- Host: GitHub
- URL: https://github.com/therolffr/customenu
- Owner: TheRolfFR
- License: lgpl-3.0
- Created: 2017-11-09T17:12:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T15:25:12.000Z (about 7 years ago)
- Last Synced: 2025-04-13T03:48:51.839Z (about 1 year ago)
- Topics: context-menu, js, js-plugin
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# custoMenu


[](http://bit.ly/therolf-website)


[](https://www.jsdelivr.com/package/gh/TheRolfFR/custoMenu)
Create custom context menus easily
## Usage
### 1. Import js and css
Import custoMenu :
```html
```
You can use jsDelivr links to keep updated your custoMenu : https://www.jsdelivr.com/package/gh/TheRolfFR/custoMenu
### 2. Create your context menu object
The menu itself has this these properties :
| | Required |Type | Desc |
| ---- |:--------:|------------- | ---- |
| name | X | String | Name of the custoMenu |
| items| X | Object | Contains your items |
And each item has these properties :
| | Required |Type | Desc |
| ---- |:--------:|------------- | ---- |
| text | X | HTML | Text of the custoMenu item |
| desc | | String | Description of the custoMenu item |
| func | X | Function | Function associated to the custoMenu item |
Example :
```javascript
var filectxmenu = {
name: 'file',
items: {
'openfile' : { // function name must be unique throught every object. If not the last function will be choosed
text: '',
desc: 'Open',
func: function() {
// your function
} // etc...
}
}
}
```
### 3. Add your object to CustoMenu in your script
```javascript
custoMenu.addMenu(filectxmenu);
```
### 4. Add class and data attributes to your elements
* class : custoMe
* data-name: file (name of your function)
```html
file.txt
```
### 5. Enjoy !
License: GNU Lesser General Public License v3.0