问题
How can I add different markers to google map v3?
Here is example for my marker:
var latlng = new google.maps.LatLng(lat,lng);
var image = "../img/hotel_icon.png";
var locationDescription = this.locationDescription;
var marker = new google.maps.Marker({
map: map,
position: latlng,
title:'pk:'+name,
icon: image
});
bounds.extend(latlng);
setMarkes(map, marker, name, locationDescription);
});//close each
map.fitBounds(bounds);
});//close getjson
}//close initialize
function setMarkes(map, marker, name, locationDescription){
google.maps.event.addListener(marker, 'mouseover', function() {
infowindow.close();
infowindow.setContent('<h3>'+name+'</h3><em>'+locationDescription+'</em>');
infowindow.open(map, marker);
});
}
回答1:
Here is one example that may help: http://www.geocodezip.com/v3_markers_normal_colored_infowindows.html
回答2:
i have resolved a problem was easy just i have put this
var currentplace = $("#currentplace").text();
if(name == currentplace ){image = "../img/hotel_icon.png";}else{ image = "../img/home_icon.png";}
来源:https://stackoverflow.com/questions/11067065/different-markers-on-google-maps-v3