谷歌地图标记API标记的标题

shi*_*iro 3 javascript google-maps

我尝试更改标题部分的颜色,但看起来标题选项不采用html格式.我怎样才能使它工作?

谢谢

var testtitle = '<font color="green">This is some text!</font> another text';   

var marker = new google.maps.Marker({
position: location,
title: testtitle,
map: map
});
Run Code Online (Sandbox Code Playgroud)

qwe*_*max 11

你必须使用InfoWindow对象

看到这个doc google map api

var infowindow = new google.maps.InfoWindow({
    content: "<span>any html goes here</span>"
});

var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: 'Uluru (Ayers Rock)'
});

google.maps.event.addListener(marker, 'click', function() {
  infowindow.open(map,marker);
});
Run Code Online (Sandbox Code Playgroud)

  • 这需要我单击该图钉,并且用于显示完整数据。我想要悬停标题。这就是为什么我使用谷歌标记。 (2认同)