Right click event

130 views
Skip to first unread message

Petr Kubasta

unread,
Dec 11, 2011, 8:59:17 PM12/11/11
to Raphaël
Hi,
it is possible to detect right mouse click event on element?

Thankx

Clifford Heath

unread,
Dec 11, 2011, 9:31:13 PM12/11/11
to raph...@googlegroups.com
On 12/12/2011, at 12:59 PM, Petr Kubasta wrote:
> it is possible to detect right mouse click event on element?

Use a normal click handler and check the event.button value.

Clifford Heath.

P_Seitz

unread,
Dec 12, 2011, 3:57:34 AM12/12/11
to Raphaël
I don't know why, but i have this version for a right click, works
with jquery

var nodeForm = r.rect(20, 20, 80, 60);
$(nodeForm.node).bind("contextmenu", function(){
alert(0);
});

Clifford Heath

unread,
Dec 12, 2011, 5:06:29 AM12/12/11
to raph...@googlegroups.com
Yes, that works too, but only with jQuery, and it's also better not to ever use .node,
since Raphael sometimes re-creates nodes - so you lose your event handler.

Clifford Heath.

> --
> You received this message because you are subscribed to the Google Groups "Raphaël" group.
> To post to this group, send an email to raph...@googlegroups.com.
> To unsubscribe from this group, send email to raphaeljs+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/raphaeljs?hl=en-GB.
>

Reply all
Reply to author
Forward
0 new messages