Giter Club home page Giter Club logo

customenu's Introduction

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

customenu's People

Contributors

therolffr avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.