https://github.com/buganini/leaflet-searchmenu
https://github.com/buganini/leaflet-searchmenu
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/buganini/leaflet-searchmenu
- Owner: buganini
- License: mit
- Created: 2014-06-18T18:37:46.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-19T18:50:46.000Z (almost 12 years ago)
- Last Synced: 2025-05-15T23:12:30.945Z (about 1 year ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
leaflet-searchmenu
Forked from https://github.com/naomap/leaflet-fusesearch
Usage
Create the control L.Control.SearchMenu and add it to the Map.
var searchCtrl = L.control.searchMenu({
search: function(string, returnFunc) {
returnFunc(["id1", "id2", "id3"]);
},
showResultFct: function() {
var name = L.DomUtil.create('b', null, container);
name.innerHTML = getName(result);
container.appendChild(L.DomUtil.create('br', null, container));
container.appendChild(document.createTextNode(getDesc(result)));
},
popup: function(result) {
getMarker(result).fire("click");
}
});
searchCtrl.addTo(map);
Options
The SearchMenu control can be created with the following options :
-
position: position of the control, the search pane shows on the matching side. Default'topright'. -
title: used for the control tooltip, default'Search' -
placeholder: used for the input placeholder, default'Search' -
maxResultLength: number of features displayed in the result list, default is null
and all features found by Fuse are displayed -
showInvisibleFeatures: display the matching features even if their layer is invisible, default true