11# CtxMenu (Javascript)
22Customizable right click context menus for your website.
33
4- [ demo (wip)] ( https://nilssoderman.com/code/ctxmenu )
4+ ![ preview] ( https://i.imgur.com/SaBFHEy.png )
5+
6+ [ demo] ( https://nilssoderman.com/code/ctxmenu )
57
68## Installation
79
@@ -54,7 +56,7 @@ var myContextMenu = CtxMenu(myElement);
5456### CtxMenu Functions:
5557
5658** addItem(**
57- text, function, ?icon ** )**
59+ text, function, ?icon, ?index ** )**
5860
5961_ Appends a new item to the menu._
6062
@@ -63,28 +65,13 @@ _Appends a new item to the menu._
6365| text | The text that will be displayed in the menu |
6466| function | The function to be called when the item is clicked |
6567| icon | Url to an icon to be displayed before the text |
68+ | index | The list index where to insert the item |
6669
6770``` javascript
6871myContextMenu .addItem (" Text Here" , myFunction, " myIcon.png" );
6972```
7073
7174
72- ** insertItem(**
73- index, text, function, ?icon ** )**
74-
75- _ Insert a new item into the menu at given position_
76-
77- | Arguments | Description |
78- | --- | --- |
79- | index | The list index where the item will be placed |
80- | text | The text that will be displayed in the menu |
81- | function | The function to be called when the item is clicked |
82- | icon | Url to an icon to be displayed before the text |
83-
84- ``` javascript
85- myContextMenu .insertItem (0 , " Text Here" , myFunction, " myIcon.png" );
86- ```
87-
8875
8976** addSeperator()**
9077
0 commit comments