A recurring need we have, is to open a dialog or a modal from within a Leaflet map. Dialogs and modals are a great way to add Feedback links, to show the legend without taking up screen space, to add a Help or About panel, etc.
A perfectly ordinary way would be a positioned DIV anchored to the edge
of the screen or to the edge of the map DIV, so it looks like a "tab".
You've surely seen this before for Feedback links along the edge of the
screen. But this time we wanted a button in-map, something that looked like a real Leaflet button. It wasn't tough to do, cuz Leaflet rocks.
Now... having done it, why not polish it up so that next time it's copy-paste simple? Here we go:
https://github.com/gregallensworth/L.Control.BootstrapModal
https://github.com/gregallensworth/L.Control.jQueryDialog
I even took the step of making a jQuery UI version. The project last week didn't use this, but it was a small step to adapt the button code, and it will surely serve us in the future.
Enjoy!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.