+ 2

contextmenu right mouseclick

hello guys, the function fahnen(fahne) is executed more often than a right-click with the mouse and left-click then also. what is wrong. thank you four you answers. document.addEventListener("contextmenu", function(ev){ $("#play_area tr td").mousedown(function(eve) { var fahne = $(this).index('td')-100; fahnen(fahne); }); ev.preventDefault(); }, false);

8th Dec 2017, 3:00 PM
micha
micha - avatar
1 Odpowiedź
+ 4
Note, context menus aren't always right click (rather, it's more like "secondary click")... left-handers, gamers, etc reprogram stuff all the time. https://developer.mozilla.org/en-US/docs/Web/Events/mousedown Look at the 'button' property, which tells you which button was just pressed; these refer to the more common right-handed arrangement. It goes on to describe how their order could be reversed, but that's annoying... if you remember that primary starts with 0, you can avoid the left/right stuff.
8th Dec 2017, 3:50 PM
Kirk Schafer
Kirk Schafer - avatar