Add Leaflet Titles to Marker Display Without Clicking

Post Reply
xgis
User
Posts: 68

Add Leaflet Titles to Marker Display Without Clicking

Post by xgis »

When using the leaflet extension the markers display but must be clicked manually to display their labels.

A better way to implement this on the "single map" option is to have the marker symbols display their title labels when the user zooms in
and each marker is singular.

When the markers are grouped no labels display, but as the user zooms in and single markers display then the title appears.

The Marker should display Without Mouse Hover or Clicking

It needs to display automatically without user interaction

It is also important that labels within close proximity not overlap if possible

This makes the experience much more efficient for the user that knows where they are on the map but want to zoom to a titled marker.


MichaelG
User
Posts: 1095

Post by MichaelG »

You need to check if Leaflet.markercluster supports such interaction first. By default it only supports the "click" event. You can however try write your "clustermouseover" event to do that. To add a handler to marker, you can do, e.g.

let markers = $("#mp_xxx").data("markerClusterer"); // Get the marker clusterer of the single map
markers.on("", 'clusterclick', function (a) {
	// your code
});

Post Reply