Right Click Event Handler (context)

285 views
Skip to first unread message

Jan Böhler

unread,
Feb 17, 2016, 7:33:24 AM2/17/16
to Snapsvg
Hi

I am new in Snap SVG.

I found Element.click(handler) and Element.dbclick(handler).

But I need something like "rightClick(handler)" to catch the right click event from the mouse.
Is there a way to use this?
at the moment it shows the WebBrowser contextmenu.

Jan



Ian

unread,
Feb 17, 2016, 9:30:54 AM2/17/16
to Snapsvg

Jan Böhler

unread,
Feb 17, 2016, 10:44:47 AM2/17/16
to Snapsvg
Thx Ian for you hint

My ended up with following solution (i use jquery for event handling in the example):

var svg = document.getElementById("world").contentDocument.documentElement;
var $svg = $(svg);

$svg.click(function () {
alert("l_clicked !!");
});
$svg.contextmenu(function () {
alert("r_clicked !!");
return false;
});

this was my help i found:
Reply all
Reply to author
Forward
0 new messages