2

I have some markers bind with popup. I need to give offset for the popup to display on the top of the markers.Now the popup hides the marker. Below is the snapshot of marker and its popup content.Here the popup hides the marker. I need to give some offset so that it is top of the marker.

Below is my code and this is not working. Stillth popup hides the marker. :

 var popup = new L.Popup({ offset:[0,6]}).setContent(contentString);
                      markerdata.bindPopup(popup).addTo(m);

could any one help me on this?

4

I've found it more effective to declare the offset when binding the popup (i.e. making it relative to the marker's position):

 var popup = new L.Popup().setContent(contentString);
 markerdata.bindPopup(popup, { offset: L.Point(0,16) }).addTo(m);

Also '6' is a small offset, which might be enough (depending on the size of your marker), but maybe try a larger one to move the popup enough to make the marker clickable/draggable etc (otherwise the popup gets in the way)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.