how can I trigger two mouse events simultanious (hold right clic and mouse weel) I have to press the right button of the mouse and hold on and at the same time I roll the wheel

    $("selector").bind("click mousewheel", (function(event, delta) {
           console.log("xxx")});
有帮助吗?

解决方案

This may be not exactly you want but it works...

Fiddle here

var rightButtonDown = false;
$(document).mousedown(function (e) {
    if (e.which === 3) rightButtonDown = true;
});
$(document).mouseup(function (e) {
    if (e.which === 3) rightButtonDown = false;
});
$(document).mousewheel(function (event, delta, deltaX, deltaY) {
    if (rightButtonDown) {
        console.log("fire!")
    }
});

Include a jQuery plugin to handle the mousewheel event.

其他提示

Try this demo http://jsfiddle.net/HeDPZ/

Try event mousedown for any kind of click i.e. right or left.

Behavior - with the mouse click of when you move wheel you will see an alert poping.

Another thing is there is a small syntax error in your closing brackets.

For OP: Do you mind telling us bit more as to what kind of functioanlity you are aiming for just so that we can help you out in more detail.

Captureing event like this http://jsfiddle.net/dQWNY/ more here: Detect middle button click (scroll button) with jQuery

  • Left - 1
  • Middle - 2
  • Right - 3

I hope this is fits your need :)

Code

$(".vendor-icon").bind("mousedown mousewheel", function (event, delta) {
    alert("xxx");
});

Associated html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top