Javascript 使用引导图标作为Google地图标记
为此奋斗了很长一段时间。我想使用引导图标作为谷歌地图标记图像。下面是我的google maps marker javascript代码:Javascript 使用引导图标作为Google地图标记,javascript,google-maps,twitter-bootstrap-3,glyphicons,Javascript,Google Maps,Twitter Bootstrap 3,Glyphicons,为此奋斗了很长一段时间。我想使用引导图标作为谷歌地图标记图像。下面是我的google maps marker javascript代码: var image = { src: '<i class="glyphicon glyphicon-move"></i>', size: new google.maps.Size(24, 24), origin: new google.maps.Point(0,0), anchor:
var image = {
src: '<i class="glyphicon glyphicon-move"></i>',
size: new google.maps.Size(24, 24),
origin: new google.maps.Point(0,0),
anchor: new google.maps.Point(12,12)
};
var marker = new google.maps.Marker({
draggable: true,
icon: image,
title: 'Drag to move to new location',
raiseOnDrag: false
});
var图像={
src:“”,
大小:新谷歌地图大小(24,24),
来源:新google.maps.Point(0,0),
主播:新谷歌地图点(12,12)
};
var marker=new google.maps.marker({
真的,
图标:图像,
标题:“拖动以移动到新位置”,
理由:错误
});
如果有人能给我举个例子吗?首先,您需要符号图标作为向量,您可以在这里购买: 对于Javascript API版本3,您可以使用以下文档中描述的SVG路径: 因此,谷歌示例代码如下:
// This example uses SVG path notation to add a vector-based symbol
// as the icon for a marker. The resulting icon is a star-shaped symbol
// with a pale yellow fill and a thick yellow border.
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: -25.363882, lng: 131.044922}
});
var goldStar = {
path: 'M 125,5 155,90 245,90 175,145 200,230 125,180 50,230 75,145 5,90 95,90 z',
fillColor: 'yellow',
fillOpacity: 0.8,
scale: 1,
strokeColor: 'gold',
strokeWeight: 14
};
var marker = new google.maps.Marker({
position: map.getCenter(),
icon: goldStar,
map: map
});
}
请检查源代码以了解更多详细信息,这里看起来您不能。阅读您可以使用标签,而不是使用cssHi控制标记,idrisjafer您找到解决方案了吗?您需要使用“传单.awesome-markers插件v2.0”