Basic Right Click Menu Plugin For jQuery - Silver Context Menu

Basic Right Click Menu Plugin For jQuery - Silver Context Menu
File Size: 7.82 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A really simple jQuery context menu plugin which helps you display a custom context menu when right click on an element you specify.

How to use it:

1. Create the context menu from an unordered html list as this:

<ul class="dropdown-menu" id="menuid">
  <li><a href="#1">First option</a></li>
  <li><a href="#2">Second option</a></li>
  <li><a href="#3">Third option</a></li>
  ...
</ul>

2. Place jQuery library and the jQuery Silver Context Menu plugin's script at the bottom of the webpage.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.silver.contextMenu.js"></script>

3. Activate the context menu and bind it to a specific element.

$('.container').silverContextMenu({
  menuSelector: '#menuid'
});

4. Style the context menu whatever you like:

ul.dropdown-menu {
  ...
}

ul.dropdown-menu > li {
  ...
}

ul.dropdown-menu > li > a {
  ...
}

5. Destroy the plugin and remove the context menu from DOM.

$('.container').silverContextMenu('destroy');

This awesome jQuery plugin is developed by cichy380. For more Advanced Usages, please check the demo page or visit the official website.