Jquery right click context menu

Does anyone have any code for jquery context menu? You just need the popup at the position of the pointer when you right-click.

+6
jquery jquery-plugins contextmenu
source share
5 answers

Here is what I found:

right-click context menu Using jquery and asp.net - code project article

Plugins are right clicked on jQuery website

Interestingly, dogo library has a standard set of user interface widgets , and the context menu is part of this standard set of user interfaces. (The dojo library is nice and beautiful with a standard look)

Dojo is a separate javascript library , like jQuery. Not sure how dojo is fully compatible with jquery, but there are ways to get them to work together if you want.

Google Lord gave me most of the answers;)


Similar questions that may be helpful:
Right-click help jQuery!
jquery context menu plugin - where is the right click event type?
JavaScript: right-clicking and disabling menus only within a specific element

+7
source share

Here is the plugin: jQuery context menu

+5
source share

Another plugin that you can use is one developed by me under the name Audero Context Menu .

0
source share

This is easily achieved using an event listener in jQuery, here is a quick and easy way to do this:

//Now add the jQuery $(document).ready(function() { //Just starting up here var menu = $('.menu');//get the menu $(document).on('contextmenu', function(e) {//What this does is simply; if right-click, run function(contains an event) e.preventDefault();//Prevent the default action: the normal right-click-menu to show menu.css({ display: 'block',//show the menu top: e.pageY,//make the menu be where you click (y) left: e.pageX//make the menu be where you click (x) }); }); $(document).click(function() { //When you left-click menu.css({ display: 'none' });//Hide the menu }); }); 
 /* just some css to display it */ .menu { background: #fff; width: 60px; padding: 3px 10px; box-shadow: 0 0 10px -3px rgba(0, 0, 0, .3); border: 1px solid #ccc; display: none; position: absolute;//this is important } 
 <!-- jQuery CDN --><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- Add some HTML for the menu --> <div class="menu"> <p>Option 1</p> <p>Option 2</p> </div> 
0
source share

 <!DOCTYPE html> <html> <head> <title>Right Click</title> <link href="https://swisnl.imtqy.com/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="stylesheet" type="text/css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://swisnl.imtqy.com/jQuery-contextMenu/dist/jquery.contextMenu.js" type="text/javascript"></script> <script src="https://swisnl.imtqy.com/jQuery-contextMenu/dist/jquery.ui.position.min.js" type="text/javascript"></script> </head> <body> <span class="context-menu-one" style="border:solid 1px black; padding:5px;">Right Click Me</span> <script type="text/javascript"> $(function() { $.contextMenu({ selector: '.context-menu-one', callback: function(key, options) { var m = "clicked: " + key; window.console && console.log(m) || alert(m); }, items: { "edit": {name: "Edit", icon: "edit"}, "cut": {name: "Cut", icon: "cut"}, copy: {name: "Copy", icon: "copy"}, "paste": {name: "Paste", icon: "paste"}, "delete": {name: "Delete", icon: "delete"}, "sep1": "---------", "quit": {name: "Quit", icon: function(){ return 'context-menu-icon context-menu-icon-quit'; }} } }); $('.context-menu-one').on('click', function(e){ console.log('clicked', this); }) }); </script> </body> </html> 
0
source share

All Articles