Lightweight Context Menu Library – class2context.js

Category: Javascript , Menu & Navigation | July 18, 2016
Author:idoctnef
Views Total:2,222 views
Official Page:Go to website
Last Update:July 18, 2016
License:MIT

Preview:

Lightweight Context Menu Library – class2context.js

Description:

class2context.js is a lightweight, simple-to-use JavaScript plugin that helps you add a custom context menu to your webpage.

How to use it:

Include the following files into your webpage.

<link rel='stylesheet' href='class2context.css'>
<script src='class2context.js'></script>

Create an array of menu items with custom icons and functions when clicked.

array=[
  ["<img src='1.png'> Menu 1", "function1()"], 
  ["<img src='2.png'> Menu 2", "function2()"],
  ["<img src='3.png'> Menu 3", "function3()"],
];

Append the context menu to a specified container like ‘demo’.

class2context('demo', "Menu Title Here", array);

You Might Be Interested In:


Leave a Reply