• This repository has been archived on 14/Aug/2021
  • Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 11 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

jQuery plugin that turns a jQueryUI menu widget into a context menu.

jquery.ui-contextmenu

GitHub version Build Status Selenium Test Status npm jsDelivr,

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+ (3.x or later recommended)
  • jQuery UI 1.9+ (at least core, widget, menu), 1.12+ recommended
  • One of the ThemeRoller CSS themes or a custom one
  • jquery.ui-contextmenu.js (also available as CDN on , cdnjs, or UNPKG)

for example

<head>
    <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
    <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="//code.jquery.com/ui/1.12.1/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

More Repositories

1

fancytree

JavaScript tree view / tree grid plugin with support for keyboard, inline editing, filtering, checkboxes, drag'n'drop, and lazy loading
JavaScript
2,721
star
2

wsgidav

A generic and extendable WebDAV server based on WSGI
Python
732
star
3

pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
Python
102
star
4

wunderbaum

A modern tree/treegrid control for the web
TypeScript
95
star
5

dynatree

Automatically exported from code.google.com/p/dynatree
JavaScript
91
star
6

persisto

Persistent Javascript objects and web forms using Web Storage
TypeScript
19
star
7

yabs

Build and deployment automation for Python projects
Python
12
star
8

arcade-js

A 2d game engine and math lib based for JavaScript and HTML5 Canvas
JavaScript
12
star
9

nutree

A Python library for tree data structures with an intuitive, yet powerful API.
Python
11
star
10

fabulist

Generate random strings that make sense.
Python
11
star
11

stressor

Stress-test your web app.
Python
10
star
12

tabfix

Cleanup whitespace in text files
Python
8
star
13

jquery-splitbutton

Combine two ui-buttons and one ui-menu.
JavaScript
5
star
14

clouddav

Automatically exported from code.google.com/p/clouddav
Python
4
star
15

docker-wsgidav

Dockerfile
3
star
16

grunt-yabs

Collection of tools for grunt release workflows.
JavaScript
3
star
17

snazzy

Stylish ANSI terminal colors and helpers.
Python
2
star
18

dynatree-stub

Obsolete stub for Dynatree 2.0 .. 2.3 on jQuery Plugin Registry
2
star
19

sneakers.js

JavaScript plugin that simulates tty decryption effect as seen in the 1992 movie Sneakers.
JavaScript
1
star
20

four-in-a-row

A web browser, online, multi-user implementation of the 'Four In A Row' game, based on Meteor
JavaScript
1
star
21

nxturtle

Control a LEGO Mindstorms robot like a Logo Turtle
Python
1
star
22

wplsync

Automatically exported from code.google.com/p/wplsync
Python
1
star