How can I show a custom DIV element on a google map as a marker?

后端 未结 1 1339
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 23:54

I want to be able to show a custom DIV element on a Google Map (V3 API) as a marker but it only seems to allow images to be used instead. Is there any way around this using the

相关标签:
1条回答
  • 2021-02-10 00:47

    Here's an excellent little library: RichMarker. Its documentation is here.

    You can use the content property of the json object passed to the constructor like this:

    var marker = new RichMarker({
          position: yourLatLng,
          map: yourMap,
          content: '<div class="my-flexible-marker">initial content</div>'
    });
    

    And later change the content with the setContent method:

    marker.setContent('<div class="my-flexible-marker">new content</div>');
    
    0 讨论(0)
提交回复
热议问题