swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Prevent right click inside context menu #730

Closed cplaiu closed 3 years ago

cplaiu commented 3 years ago

Hello, I would like to know if it is possible to avoid right clicking inside the context menu.

Now when you right click inside it calls the callback function, but I wish it would do nothing and the menu would not close

CodePen Example

Thanks

bbrala commented 3 years ago

You could try and check in the callback if the e (event) was triggered by another mousebutton, then return false. See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button