google map api v3: can I use a div instead of an image to create the custom icon?

前端 未结 2 409
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 08:40

google map api v3: can I use a div instead of an image to create the custom icon?

i want to be able to hover the marker and change the icon, ven betetr if i could us

相关标签:
2条回答
  • 2021-01-18 08:58

    First, I give the demo-purpose website.

    For this question, I have found there are several similar questions which I have already answered such as:

    (following one is about theory)

    HTML/CSS Markers using Google Maps Javascript API v3

    (following one is about implementations)

    How to create custom marker for google map

    At first answer, I have given my detailed understanding why customized icons and markers should be implemented by extending overlayView class. At second answer, I have posted out how to write HTML/CSS to specify how one customized icon/marker looks. Of course you can also write event handlers to add JS logic to your icon/marker.

    At stack overflow, I found several interesting points. When I found similar questions, I cannot answer the question using my previous answer. One content manager even deletes my answer although what I am answering here is exactly the question is asking.

    At last, if you need to see how to extend overlayView class to realize one marker, please see this source code (starting below comment //====custom-marker management starts)

    Thank you.

    0 讨论(0)
  • 2021-01-18 09:02

    Yes, You can use Custom Overlays in place of markers:

    http://code.google.com/apis/maps/documentation/javascript/overlays.html#CustomOverlays

    0 讨论(0)
提交回复
热议问题