right-mouse-button

Jquery: detect if middle or right mouse button is clicked, if so, do this:

☆樱花仙子☆ 提交于 2019-11-27 08:55:37
Check out my jsfiddle demo , if e.which == 1 then when you left click the h2 it will e.which == 2 or e.which == 3 then it wont work. 2 is the middle mouse button, and 3 is the right mouse button. i found this too: JQuery provides an e.which attribute, returning 1, 2, 3 for left, middle, and right click respectively. So you could also use if (e.which == 3) { alert("right click"); } This code isn't working: code: $("h2").live('click', function(e) { if( e.which == 2 ) { e.preventDefault(); alert("middle button"); } }); burntblark You may want to trap the mousedown event, and you also need to

Jquery: detect if middle or right mouse button is clicked, if so, do this:

蹲街弑〆低调 提交于 2019-11-26 14:22:30
问题 Check out my jsfiddle demo, if e.which == 1 then when you left click the h2 it will e.which == 2 or e.which == 3 then it wont work. 2 is the middle mouse button, and 3 is the right mouse button. i found this too: JQuery provides an e.which attribute, returning 1, 2, 3 for left, middle, and right click respectively. So you could also use if (e.which == 3) { alert("right click"); } This code isn't working: code: $("h2").live('click', function(e) { if( e.which == 2 ) { e.preventDefault(); alert(