I am searching a plugin for Leaflet, to have an infobox at the border of the map. Please look at my screenshot.
A click on the info button should be open a window. In this window I would like to have some additional informations.
I have not found such a plugin within https://leafletjs.com/plugins.html
Maybe I have overlook a plugin with this function?
Background software: I am use the gis qgis with qgis2web plugin. With this plugin I can export a fully leaflet website. After export I have the possibilty to change the code and maybe insert a leaflet plugin.
Best Answer
Control
L.control.info
below was written as an exercise of what does it take to write simple custom control as extension of basicL.Control
object. It's not very 'by the book' and not very well tested, just an exercise.Control consists of button with (styled) title and (styled) text which is displayed uppon clicking on button.
Options:
title
- HTML formatted title text, default is'Info'
titleTooltip
- tooltip text for title button, default is'Click here for more info'
content
- HTML formatted text, which is displayed uppon button clickmaxWidth
- maximum width of displayed contenttitleClass
- CSS style class for titlecontentClass
- CSS style class for contentMethods:
setTitle(txt)
- set title textsetTitleTooltip(txt)
- set title tooltipsetContent(txt)
- set content textsetTitleClass(cssClass)
- set CSS class for titlesetContentClass(cssClass)
- set CSS class for contentControl:
JSFiddel example: https://jsfiddle.net/TomazicM/rqu3nvLj/