Search code examples
javascriptgmaps4rails

Gmaps4rails: How to create rich marker in javascript?


I add a marker to user location like this:

Gmaps.map.callback = function() {
  Gmaps.map.createMarker({Lat: lat,
                          Lng: lng, 
                          rich_marker: null, 
                          marker_picture: ""
  });
}

, but I'd like to change the image of the marker. Rich marker seems to be the solution, but I can't get the rich_marker constructed correctly.

Could anyone give an example of rich marker construction.


Solution

  • You should do:

    Gmaps.map.callback = function() {
      Gmaps.map.rich_marker = true;
      Gmaps.map.createMarker({Lat: lat,
                          Lng: lng, 
                          rich_marker: your_custom_html, 
                          marker_picture: ""
      });
    }