Skip to content

TheRolfFR/custoMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custoMenu

Drop, enjoy Author License: LGPL--3.0 Repo Size jsDelivr Hits

Create custom context menus easily

Usage

1. Import js and css

Import custoMenu :

<script src="path/to/custoMenu.js"></script>
<link  href="path/to/custoMenu.css" rel="stylesheet" />

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 :

var filectxmenu = {
	name: 'file',
	items: {
		'openfile' : { // function name must be unique throught every object. If not the last function will be choosed
			text: '<i class="material-icons">&#xE254;</i>',
			desc: 'Open',
			func: function() {
				// your function
			} // etc...
		}
  }
}

3. Add your object to CustoMenu in your script

custoMenu.addMenu(filectxmenu);

4. Add class and data attributes to your elements

  • class : custoMe
  • data-name: file (name of your function)
<div class="custoMe" data-name="file">file.txt</div>

5. Enjoy !

License: GNU Lesser General Public License v3.0

About

Create custom context menus easily

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors