如何在不同的事件上更改标记或标记图像的大小 但是标记位于页面加载上 唯一的办法是改变大小
function onload(){
var location = new google.maps.LatLng(latt, lngg);
img = new google.maps.MarkerImage('../Images/' + imgN, null, null, null, new google.maps.Size(30, 40));
marker = new google.maps.Marker({
position: location,
id: poiId,
animation: google.maps.Animation.DROP,
draggable: false,
icon: img,
html: hml,
map: map,
draggable:true
});
}
我用于更改标记图像的zie的两行以下
var iconIm = new google.maps.MarkerImage('../Images/imagesPink.png', null, null, null, new google.maps.Size(70, 90));
marker.icon = iconIm;
答案 0 :(得分:1)
试试这个。
API Google map v3 : change markers' size on zoom_changed
for(i=0; i< markers.length; i++ ) {
var icon = markers[i].getIcon();
markers[i].setIcon(new google.maps.MarkerImage(
icon.url,
new google.maps.Size(largeur, hauteur),
new google.maps.Point(0, 0),
new google.maps.Point(0, 0),
new google.maps.Size(largeur, hauteur))
);
}