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 -

Reply via email to