Javascript, Change google map marker color

后端 未结 9 1245
自闭症患者
自闭症患者 2020-12-07 11:44

May I know a way to change the Google Map marker color via Javascript.. I am new at this and any help would be much appreciated, Thank you.

I used the following code

9条回答
  •  佛祖请我去吃肉
    2020-12-07 12:07

    you can use the google chart api and generate any color with rgb code on the fly:

    example: marker with #ffffd color:

    http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|ffffd
    

    include as stated above with

     var marker = new google.maps.Marker({
        position: marker,
        title: 'Hello World',
        icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|ffffd'
    });
    

提交回复
热议问题