Yes, you're right; there is no default event handler for double right-
click.
The code you introduced won't really simulate the double click; it
will consider any two right-clicks a double click, which is not the
wanted behaviour. Refer to the code above shared by Ricardo (http://
Thanks for the latest code, it seems it's working fine, but I only
tried your example and didn't port it to my page.
I tested it on IE and FF and both were ok. In Opera I was receiving
the evente after changing some setting, but the context menu is still
there.
Anyway, thanks again :)
On Nov
PROTECTED] On
Behalf Of ricardobeat
Sent: Sunday, November 30, 2008 9:24 AM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
I didn't test it in IE... no cookie.
Apparently the 'mousedown' event was at random not carrying the
property that tells us what button was clicked
is interpreted as button 2?
JK
-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ricardobeat
Sent: Sunday, November 30, 2008 6:31 PM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
returning false from
I don't think there's a default double right click event handler, but this
wouldn't be that hard to write.
Psuedo code
---
$('#someElement').rightclick(function(){
totalClicks = 0;
if (totalClicks == 2) {
// do some stuff
totalClicks = 0;
Thanks for the code... but I couldn't manage to make it work at all in
IE and in FF the only time it worked is if I replaced $('body') with $
('html)! Any idea how to make it work with a specific element; e.g.
and image with id=myImage, because when I tried $('#myImage') it
didn't work as well.
I forgot to mention also that I disabled the context menu with the
code
$('html').bind(contextmenu, function(e) {return false;});
and if I didn't do that, the context menu will appear and every right-
click then will fire the double-click event in IE. I guess that's
because in IE the
I didn't test it in IE... no cookie.
Apparently the 'mousedown' event was at random not carrying the
property that tells us what button was clicked, a triple click was
needed. I switched to mouseup and it seems to work fine, I also had
forgotten to clear the timeout and set the var to false when
Of ricardobeat
Sent: Sunday, November 30, 2008 9:24 AM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
I didn't test it in IE... no cookie.
Apparently the 'mousedown' event was at random not carrying the
property that tells us what button was clicked, a triple click was
needed. I
: Sunday, November 30, 2008 9:24 AM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
I didn't test it in IE... no cookie.
Apparently the 'mousedown' event was at random not carrying the
property that tells us what button was clicked, a triple click was
needed. I switched
is interpreted as button 2?
JK
-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ricardobeat
Sent: Sunday, November 30, 2008 6:31 PM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
returning false from the handler should
PROTECTED] On
Behalf Of ricardobeat
Sent: Sunday, November 30, 2008 9:24 AM
To: jQuery (English)
Subject: [jQuery] Re: Double right-click, anyone?
I didn't test it in IE... no cookie.
Apparently the 'mousedown' event was at random not carrying the
property that tells us what button
A quick implementation:
$('body').unbind('mousedown').mousedown(function(e){
var rightclick = (e.which)
? (e.which == 3)
: (e.button == 2);
var t = $(this);
if (rightclick) {
console.log('rightclick');
if (t.data('rightclicked')) {
13 matches
Mail list logo