谷歌地图标记API标记的标题 [英] title of a marker of google map marker API

查看:100
本文介绍了谷歌地图标记API标记的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试更改标题部分的颜色,但看起来像标题选项不采用html格式。

谢谢

  var testtitle ='< font color =green>这是一些文字!< / font>另一个文本'; 

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


解决方案

您必须使用InfoWindow对象

请参阅此文档 google map api a>

  var infowindow = new google.maps.InfoWindow({
content:< span> any html去这里< / span>
});

var marker = new google.maps.Marker({
position:myLatlng,
map:map,
title:'Uluru(艾尔斯岩石)'
});

google.maps.event.addListener(marker,'click',function(){
infowindow.open(map,marker);
});


I try to change the color of part of the title, but look like the title option does not take html format. How can I make it work?

Thank you

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

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

解决方案

you must use InfoWindow object

see this 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);
});

这篇关于谷歌地图标记API标记的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆