0

So I'm trying to add a pretty simple context menu like the example given at:

http://gmap3.net/examples/context-menu.html

However, this example is pretty complex and not a great starting point to learn from.

I simply want to create a context menu that has 2 or 3 outbound links (that include the latlng on right click). Can anyone give me a simpler example to work from?

Thanks

skaffman
  • 398,947
  • 96
  • 818
  • 769
bluedaniel
  • 2,079
  • 5
  • 31
  • 49
  • Have you found something yet, I am also looking for a GM V3 context menu library: http://stackoverflow.com/questions/7168394/google-map-v3-context-menu – Horst Walter Aug 23 '11 at 22:53

1 Answers1

0

In the example, you will need to change the following code:

 // MENU : ITEM 1
  menu.add('Direction to here', 'itemB', 
    function(){
      menu.close();
      addMarker(false);
    });

etc.

Now, to add your own contect menu items, try something like this

  menu.add('OutboundLink1', 'CSS_class_for_this_link', 
    function(){
        var lat=$map.gmap3('getLatlng').lat();
        var lon=$map.gmap3('getLatlng').lon();
        window.open('someurl?lat='+lat+'&lon='+lon, 'window name', 'window settings');
        menu.close();
    });

etc.

Note that you will have to provide your own CSS styling for the context menu.

Tomm
  • 2,142
  • 1
  • 15
  • 19