[英]How can i add a marker image icon on gmaps.js
我正在将GMaps.js用于WordPress页面。 但我想在那里更改标记图标。 他们告诉使用$('<img/>').attr('src', url) .appendTo('#map');
我当前的代码
var map;
$(document).ready(function(){
map = new GMaps({
el: '#map',
lat: -12.043333,
lng: -77.028333
});
map.addMarker({
lat: -12.042,
lng: -77.028333,
title: 'Marker with InfoWindow',
infoWindow: {
content: '<p>HTML Content</p>'
}
});
});
现在如何在其中包含PNG图标作为标记图像?
转到此处: http : //hpneo.github.io/gmaps/documentation.html#GMaps-addMarkers ,搜索“ createMarker”。
此处表示createMarkers接受google.maps.markerOptions中的所有选项。 跟随此链接: google.maps.markerOptions
它在列表中显示“ icon”。 因此,将带有url的icon属性添加到您的图像。
在createMarker的正下方是addMarker。 它接受与createMarker相同的参数。
这应该使您朝正确的方向前进。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.