[jQuery] Re: Double right-click, anyone?
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:// jsbin.com/iyegu/) for a sample... the timeout is something required to simulate a real double click. Thanks for sharing your thoughts :) On Dec 1, 6:36 pm, Andy Matthews [EMAIL PROTECTED] wrote: 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; } else { totalClicks++; } }); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of TheBlueSky Sent: Saturday, November 29, 2008 6:21 AM To: jQuery (English) Subject: [jQuery] Double right-click, anyone? Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
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 30, 9:23 pm, ricardobeat [EMAIL PROTECTED] wrote: 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
I agree with you about double right-clik and Mac users, however, it's only an option available in part of the page (a DIV for example) to do something that can be also done in another way, so Mac users will not be screwed :) Thanks for the suggestion. On Nov 30, 10:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
One of the most things that I hate in some websites is disabling the right-click and/or the context menu, so I'm totally with you about this, however, think about Google Maps, they have double right-click and they disable the context menu on Maps area, which can't be discribed as bad UI design, because finally none of the context menu options makes sense there, or as what I see, at least comparing to the custom conext menu or the double right-click ease of use. On Dec 1, 10:42 am, seasoup [EMAIL PROTECTED] wrote: I'd also like to chime in that double-right click is probably not very good UI design. No one expects to have to double right click something and people will probably be even more pissed that the context menu is gone. People like that thing. Why do you seek to disable it? I'm curious. On Nov 30, 6:40 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: Have you ever tried capturing the right-click event in Opera? It has an additional level of security whereby each client must expressly set the user preferences allowing a website to capture the right-click event and stop the right-click bubble. The project I worked on last year had a right-click requirement which would not play well with Opera. There is a user-friendly aspect of this too, as some users don't WANT their browser-specific context menus to be taken away. This is why I recommended the CTRL-Click. As regards the Mac, I haven't tested that. Are you sure a Mac option-click 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 cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone
[jQuery] Re: Double right-click, anyone?
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; } else { totalClicks++; } }); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of TheBlueSky Sent: Saturday, November 29, 2008 6:21 AM To: jQuery (English) Subject: [jQuery] Double right-click, anyone? Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.
[jQuery] Re: Double right-click, anyone?
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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[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 to mouseup and it seems to work fine, I also had forgotten to clear the timeout and set the var to false when the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
returning false from the handler should cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
Have you ever tried capturing the right-click event in Opera? It has an additional level of security whereby each client must expressly set the user preferences allowing a website to capture the right-click event and stop the right-click bubble. The project I worked on last year had a right-click requirement which would not play well with Opera. There is a user-friendly aspect of this too, as some users don't WANT their browser-specific context menus to be taken away. This is why I recommended the CTRL-Click. As regards the Mac, I haven't tested that. Are you sure a Mac option-click 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 cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
I'd also like to chime in that double-right click is probably not very good UI design. No one expects to have to double right click something and people will probably be even more pissed that the context menu is gone. People like that thing. Why do you seek to disable it? I'm curious. On Nov 30, 6:40 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: Have you ever tried capturing the right-click event in Opera? It has an additional level of security whereby each client must expressly set the user preferences allowing a website to capture the right-click event and stop the right-click bubble. The project I worked on last year had a right-click requirement which would not play well with Opera. There is a user-friendly aspect of this too, as some users don't WANT their browser-specific context menus to be taken away. This is why I recommended the CTRL-Click. As regards the Mac, I haven't tested that. Are you sure a Mac option-click 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 cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: If I might make a suggestion. Right-click context menus are inherently not cross-platform compatible, as Opera will not cancel the default right click popup. Any any Mac users without a right mouse button are screwed. I personally suggest using CTRL-Click. This works on a Mac testing for the e.MetaKey property on the click event (CTRL-Click and Option-Click) And instead of a double-right-click, you could just bind to the standard dblclick event, and test for e.MetaKey==true. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL 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, 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 the double click happened. Check out the new version: http://jsbin.com/iyegu/ cheers, - ricardo On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote: 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 double-click event won't fire until the time out duration finishes and in FF it's the opposite, i.e. the event won't fire after the time out duration! On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote: 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. By the way, for IE I replaced console.log() with alert(), but no success. On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: 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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Double right-click, anyone?
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')) { console.log('double click!'); } else { t.data('rightclicked',true); setTimeout((function(t){ return function(){ t.data ('rightclicked',false); } })(t), 300); }; }; }); - ricardo On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote: Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.