How to detect right click + left click

后端 未结 6 674
感动是毒
感动是毒 2021-01-13 19:22

I am building a game

And I need to do something when the user clicks on the right mouse button, holds it and then presses the left button

6条回答
  •  北海茫月
    2021-01-13 19:59

    You can try this one.

    window.oncontextmenu = function () {
      showCustomMenu();
      return false;     // cancel default menu
    }
    

    on right click every browser has default menu for refreshing page, printing, saving and lot more but you can try this one and may be it will prevent default action and add your custom. please write down answer if it will help you.

提交回复
热议问题