Circle With Popup Text on MouseOver ?

542 views
Skip to first unread message

TheProfessorJenkins

unread,
Oct 23, 2015, 7:03:06 PM10/23/15
to Leaflet
Hi,
i search for a combination with a circle and a mouseover event,
u can see a example here :
http://jsfiddle.net/uuLszmmk/8/

somebody know a simple solution maybe ?

thx

TheProfessorJenkins

unread,
Oct 23, 2015, 7:08:44 PM10/23/15
to Leaflet

ghybs

unread,
Oct 23, 2015, 10:31:17 PM10/23/15
to Leaflet
Hi,

The L.Circle emits `mouseout` events when the mouse goes over the popup.
Popups on vector layers open at the current mouse position, so as soon as the mouse goes 1 pixel up, the mouseout event is fired and closes the popup (if it is setup to close on your L.Circle mouseout).
The same issue affects L.CircleMarker.

To overcome this, you can offset the opening the position of the popup, or open it at specified LatLng position:
http://jsfiddle.net/uuLszmmk/11/

This also means that your user will never be able to put his/her mouse over the popup, because it will close as soon as it reaches it (or if the offset is too big and creates a gap between the layer and the popup).
If you need to overcome this, you will have to come up with a more sophisticated scheme rather than simply closing the popup on mouseout.

If this is not a problem for you, you could consider using this plugin instead of having to build the opening/closing circuitry yourself: https://github.com/Leaflet/Leaflet.label

Hope this helps.

TheProfessorJenkins

unread,
Oct 24, 2015, 12:35:20 AM10/24/15
to Leaflet
hmm, for me the cyrcle marker works perfect and thats what i want :-)
i nitice a flickering on the middle marker but i dont want this marker, so for me it looks ok !

thx !
Reply all
Reply to author
Forward
0 new messages