So I'm trying to add a pretty simple context menu like the examp开发者_运维技巧le 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
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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论