Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Mootools simple context menu implementation
JavaScript CSS
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Docs
Source
README.md
index.html
package.yml

README.md

Dv Cmenu

Simple context menu mootools implementation.

Demo

How to use

In head:

<link rel="stylesheet" type="text/css" href="dv_cmenu/dv_cmenu.css">
<script type="text/javascript" language="javascript" src="dv_cmenu/dv_cmenu.js"></script>

In body:

<script type="text/javascript">
function show_cmenu( _void, _evt, _someid) {
 var items = [];
 items.push([ 'Create', function( _f){
   alert( 'Do create');
 }]);
 items.push([ 'Edit', function( _f){
   alert( 'Do edit');
 }]);
 items.push([ 'Delete', function( _f){
   var r = confirm( 'Are you sure to delete ' + _someid + ' record?');
   if ( !r) return;
   alert( 'Do delete');
 }]);
 dv_cmenu.set_items( _void, items);
 dv_cmenu.show( _void, _evt.page.x - 10, _evt.page.y - 10);
}

window.addEvent('domready', function(){
 dv_cmenu = new dv_cmenuT( 'divCM');
 $('elem').addEvent( 'click', function( _e){
     if ( _e) _e.stop();
     show_cmenu( 'void', _e, 'someid');
   });
 $('elem').addEvent( 'contextmenu', function( _e){
     if ( _e) _e.stop();
     show_cmenu( 'void', _e, 'someid');
 });
});
</script>

<div id='divCM'></div>

<a href='' id='elem'>Click left or right mouse here</a>
Something went wrong with that request. Please try again.