I would like to display a menu on a shape (cercle,rectangle,polygon) by right-clicking and select and execute a function (change color, ...) on it.
1) I begin by defining an event to my shape:
google.maps.event.addListener(myShape, 'rightclick', function(event) {...}
2) then I define a div and create the menu:
myMenu = document.createElement("div");
myMenu.className = 'contextmenu';
myMenu.innerHTML = "<a id='menu1'>item 1<\/a><a id='menu2'>item 2<\/a>";
3) after I must associate this div to my shape:
I DON'T KNOW HOW TO PROCEED
4) Finally I must display in event.LatLng position the menu:
I DON'T KNOW HOW TO PROCEED, probably something like so:
$('.contextmenu').css('left',x );
$('.contextmenu').css('top',y );
Could you help ?