Skip to content

Library for displaying a customizable context menu on right-click mouse button

Notifications You must be signed in to change notification settings

TwisterMW/js-context-menu

Repository files navigation

Build Status

npm version

ContextMenuJS

Library for displaying a customizable context menu on right-click mouse button

REQUIREMENTS

  • FontAwesome (Included by bower)
  • Node
  • NPM

USAGE

Declare icons and labels for contextual menu options

var mlist = {
	"arrow-circle-left": "Atrás",
	"undo": "Deshacer",
	"refresh": "Recargar",
	"question-circle": "Ayuda",
	"close": "Cerrar"
};

Note that "mlist" is a dictionary which Key is the name of the icon (font-awesome library) and Value is the label of the option.

You need to declare also the context menu actions for each button like this:

var mlinks = Array(
	"alert('Seleccionada la opción atrás')",
	"alert('Seleccionada la opción Deshacer')",
	"alert('Seleccionada la opción Recargar')",
	"alert('Seleccionada la opción Ayuda')",
	"alert('Seleccionada la opción Cerrar')"
);

Finally only need to instantiate the ContextMenu object like:

var cm = new ContextualMenu(mlist, mlinks);

TESTING

You can run test suite by running: karma start karma.conf.js

About

Library for displaying a customizable context menu on right-click mouse button

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published