Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ui-contextmenu

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ui-contextmenu

Turn a jQuery UI Menu widget into a contextmenu.

  • 1.18.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
535
decreased by-9.93%
Maintainers
1
Weekly downloads
 
Created
Source

jquery.ui-contextmenu

GitHub version Build Status Selenium Test Status npm

A jQuery plugin that provides a context menu (based on the standard jQueryUI menu widget).

  • Define menus from <ul> element or definition list (i.e. [{title: "Paste", cmd: "paste"}, ...]).
  • Themable using jQuery ThemeRoller.
  • Supports delegation (i.e. can be bound to elements that don't exist at the time the context menu is initialized).
  • Optional support for touch devices.

Status

The latest release is available at npm Registry:

$ npm install ui-contextmenu

GitHub version See also the Change Log.

Demo

Live demo page:
sample

See also the unit tests and live examples

More:

Getting Started

First, include dependencies:

  • jQuery 1.7+ (1.10 or later recommended)
  • jQuery UI 1.9+ (at least core, widget, menu), 1.11+ recommended
  • One of the ThemeRoller CSS themes or a custom one
  • jquery.ui-contextmenu.js (also available as CDN on jsDelivr, cdnjs, or UNPKG)
<head>
    <link href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    <script src="assets/jquery.ui-contextmenu.min.js"></script>

Assume we have some HTML elements that we want to attach a popup menu to:

<div id="container">
    <div class="hasmenu">AAA</div>
    <div class="hasmenu">BBB</div>
    <div class="hasmenu">CCC</div>
</div>

Now we can enable a context menu like so:

$("#container").contextmenu({
	delegate: ".hasmenu",
	menu: [
		{title: "Copy", cmd: "copy", uiIcon: "ui-icon-copy"},
		{title: "----"},
		{title: "More", children: [
			{title: "Sub 1", cmd: "sub1"},
			{title: "Sub 2", cmd: "sub1"}
			]}
		],
	select: function(event, ui) {
		alert("select " + ui.cmd + " on " + ui.target.text());
	}
});

Alternatively we can initialize the menu from embedded <ul> markup.

For more information:

Credits

Thanks to all contributors.

Browser Status Matrix

Selenium Test Status

Keywords

FAQs

Package last updated on 28 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc