Click Event on Marker / Custom Popup #2060
-
Hi there I'm wondering whether it is possible to have a click event on markers. I couldn't find anything in the docs. I'd like to have a sort of custom pupup, which is not bound to a specific marker but rather a general popup window. See the attached image as an example. Does anyone have an idea how to implement this with maplibre? Thank's a lot! 🫶 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @dariokueffer. Not related to your question, but we will have a small MapLibre Switzerland meetup in Olten on Jan 30th, 2023, at 18:30. Let me know if you would like to join. You find me on slack at https://slack.openstreetmap.us |
Beta Was this translation helpful? Give feedback.
-
If the markers are part of the style-spec (not html markers) than you need to |
Beta Was this translation helpful? Give feedback.
If the markers are part of the style-spec (not html markers) than you need to
queryRenderFeautre
in the callback of themap.on('click', ...)
event.Once you get the feature and some properties you saved with it you can call whatever UI framework you use to create a toast/bottom banner.
If the markers are html markers then this is a "regular" html interaction you need to implement.
Hope that helps.
The following is an example of HTML markers:
https://israelhiking.osm.org.il/