An open API service indexing awesome lists of open source software.

https://github.com/buganini/leaflet-searchmenu


https://github.com/buganini/leaflet-searchmenu

Last synced: 12 months ago
JSON representation

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
  • Example

    http://antology.me/vegan/.