Reputation: 517
how can i change size of marker or Marker image on different events but marker is place on page load only thing is to change size
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
});
}
below two lines i am using to change the zie of marker image
var iconIm = new google.maps.MarkerImage('../Images/imagesPink.png', null, null, null, new google.maps.Size(70, 90));
marker.icon = iconIm;
Upvotes: 0
Views: 1174
Reputation: 2100
Try this.
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))
);
}
Upvotes: 1