Macejkou
Macejkou

Reputation: 686

Checkbox on google maps marker

Is it possible to have checkbox on google map marker? So user can check some markers and then display details of checked places. Thank you

Upvotes: 0

Views: 915

Answers (1)

SWa
SWa

Reputation: 4363

You can toggle the image like this:

marker = new google.maps.Marker({
  map:map,
  icon: blueIcon,
  draggable:true,
  animation: google.maps.Animation.DROP,
  position: parliament
});
google.maps.event.addListener(marker, 'click', changeIcon);


  function changeIcon() {
    if (marker.icon != redIcon) {
      marker.setIcon(redIcon);
    } else {
      marker.setIcon(blueIcon);
    }
  }

Fiddle: http://jsfiddle.net/Mxwxt/7/

The alternative would be to create a custom overlay which can contain markup

Upvotes: 2

Related Questions