Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 793 Bytes

File metadata and controls

41 lines (31 loc) · 793 Bytes

marker.setSnippet()

Change the marker snippet.

<div id="map_canvas"></div>
var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div);
map.one(plugin.google.maps.event.MAP_READY, function() {

  // Add a marker
  map.addMarker({
    'position': {
      lat: 0,
      lng: 0
    },
    'title': "Click me!",
    'snippet': 'This is the snippet string.'
  }, function(marker) {

    // Show the infoWindow
    marker.showInfoWindow();

    // Catch the MARKER_CLICK event
    marker.on(plugin.google.maps.event.INFO_CLICK, function() {

      // Change the marker snippet.
      marker.setSnippet("This plugin is awesome!");

      // Redraw (reopen) the infoWindow.
      marker.showInfoWindow();

    });
  });
});