Question

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")});
Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top