function createMarker(latlng, item) {
var marker = new google.maps.Marker({
position: latlng,
map: map
});
这段代码的一部分。在网站上它显示为标准标记,大家都喜欢它,只是有点红。我怎样才能将其改成另一种颜色呢?
function createMarker(latlng, item) {
var marker = new google.maps.Marker({
position: latlng,
map: map
});
这段代码的一部分。在网站上它显示为标准标记,大家都喜欢它,只是有点红。我怎样才能将其改成另一种颜色呢?
您应该使用icon
属性。例如,
var marker = new google.maps.Marker({
position: latlng,
map: map,
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
});
在google.com上有许多可用的颜色。只需将green-dot
替换为您的颜色,例如:
http://maps.google.com/mapfiles/ms/icons/green-dot.png
http://maps.google.com/mapfiles/ms/icons/blue-dot.png
http://maps.google.com/mapfiles/ms/icons/red-dot.png
http://maps.google.com/mapfiles/ms/icons/yellow-dot.png
(要获取图像URL,请将鼠标悬停在其上或使用右键单击 → “复制图像位置”等)
更多内容请访问:https://sites.google.com/site/gmapsdevelopment/ 或者 搜索 获取更多信息。