Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/konapun/jquery.context-menu.js

Turn an element into a context menu
https://github.com/konapun/jquery.context-menu.js

Last synced: 22 days ago
JSON representation

Turn an element into a context menu

Awesome Lists containing this project

README

        

#jquery.context-menu.js
Treat an HTML element as a context menu

## Usage

```html





Context Menu Heading
×




Context Menu Body



...


```

```js
var cm = $('#context-menu').contextMenu({
container: $('#menu-container')
});

/* Optional show/hide on demand */

cm.show({ // manually give display coords
x: 0,
y: 0
});

$('#menu-container').on('click', function(e) { // use an event to get coords for display
cm.show(e);
});
```

## Options
* **container** [default: *undefined*]: An element which, when clicked on, automatically shows the context menu at the location where it was clicked
* **closeClass** [default: *menu-close*]: The class for an element which, when clicked on, will hide the context menu