API Google map v3 : change markers' size on zoom_changed

后端 未结 1 1569
情深已故
情深已故 2021-01-07 02:39

I need some help on the Google Maps API v3.

I have a map with markers (which are pictures), informations from a database. The pictures and the map are ok at this tim

相关标签:
1条回答
  • 2021-01-07 03:02

    According to the docs, setIcon either takes a string or a MarkerImage object. Initially you set a MarkerImage, but in your listener code, you do not construct a MarkerImage. Try something like this instead:

        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))
        );
    }
    
    0 讨论(0)
提交回复
热议问题