I have a list with a tags to play some mp3 files onclick. It is working fine when binding on the 'click' event with jQuery:
$oo.data({'__mp3play':true,'wapiHandle':h+0,'wapiIndex':o.ajaxPlayList[h].length})
.bind( 'click', function()
{ var wh = $j(this).data('wapiHandle');
if( typeof o.regObjects[wh] == 'object' && o.regObjects[wh].play(this.href))
{ return false; }
});
When clicking the left mouse button: It disables default handling when my flash plugin is loaded otherwise it will be opened normally.
BUT: When I use the scrollbutton of the mouse and click on it, the click event will not fired and the link opens normally.
I have tried to use mousedown or mouseup events but doesn't help, the link always opens normally with the side effect that the music starts playing also with the flash player.
Also preventDefault()
does not work at all.
Can somebody tell me how to detect the middle mouse button click (scroll button click)?
Thank you for your comments.
PS: I have already tried other solutions about the 'middle button' available on this site.
Tested in all kind of browsers with the same result.
EDIT: This also does not work, the link will be opened normally when using the middle mouse button. When using the left mouse button, nothing happen.
$oo.bind( 'mousedown click mouseup', function(e)
{ e.preventDefault(); e.stopPropagation(); return false; });
click
to be invoked for a middle-click? They're not the same - you wouldn't expect it for right-click would you? And what did you try with themousedown
approach? Did you check theevent.which
property to identify which button had been pressed? – Klimanclick
is not fired when the middle mouse button is clicked. However, it turns out you're correct about thepreventDefault()
andstopPropagation()
not having any effect and I can't think of any workaround at the moment. Here's a fiddle that shows how far I got with this usingmousedown
andmouseup
– Kliman