0

我如何在不同事件上更改标记或标记图像的大小,但标记放置在页面加载上唯一的事情就是更改大小

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;
4

1 回答 1

1

尝试这个。

API Google map v3:在 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))
    );
}
于 2013-09-15T07:17:12.667 回答