我一直在研究这个小提琴,我想要一些建议.
如您所见,我无法在正确的位置渲染多个标记.无论我做什么,两个标记都根据htmlMarker[i]阵列中第二个标记的位置进行渲染.
谢谢你的帮助!
供参考,这是JS:
var overlay;
function initialize() {
var myLatLng = new google.maps.LatLng(62.323907, -150.109291);
var mapOptions = {
zoom: 11,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var gmap = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
function HTMLMarker(lat,lng){
this.lat = lat;
this.lng = lng;
this.pos = new google.maps.LatLng(lat,lng);
}
HTMLMarker.prototype = new google.maps.OverlayView();
HTMLMarker.prototype.onRemove= function(){}
//init your html element here
HTMLMarker.prototype.onAdd= function(){
div = document.createElement('DIV');
div.className = "htmlMarker";
div.innerHTML = '<img src="http://www.vcsd.org/img/icon/red.png">';
var panes = this.getPanes();
panes.overlayImage.appendChild(div);
}
HTMLMarker.prototype.draw = …Run Code Online (Sandbox Code Playgroud)