leaflet-searchbox
A google map style search box which includes a side panel slider control.
depends on https://github.com/smeijer/leaflet-geosearch
Demo
http://leaflet-searchbox.bungos.me/
Snapshots
Code Example
const L = ;;{console;}var map = L;mapzoomControl;map;var control =// remove these if dont need sidebarsidebarTitleText: 'Header'sidebarMenuItems:Items:type: "link" name: "Link 1 (github.com)" href: "http://github.com" icon: "icon-local-carwash"type: "link" name: "Link 2 (google.com)" href: "http://google.com" icon: "icon-cloudy"type: "button" name: "Button 1" onclick: "alert('button 1 clicked !')" icon: "icon-potrait"type: "button" name: "Button 2" onclick: "button2_click();" icon: "icon-local-dining"type: "link" name: "Link 3 (stackoverflow.com)" href: 'http://stackoverflow.com' icon: "icon-bike";map;map
Options
Option | Type | Default | Description |
---|---|---|---|
provider | Provider | OpenStreetMapProvider | provider from leaflet-geosearch |
resultItemClickCallback | callback | resultItemClickCallback | default panTo to location fire 'geosearch/showlocation' event and hide search result. context:SearchBox |
suggest | callback | suggest | provide suggest when query locationcontext:SearchBox |
resultItemTemplate | string | see source | result item template use lodash.template |
Acknowledgments
leaflet-searchbox was inspired by leaflet-custom-searchbox
Some thing I did
- fix some styles
- with leaflet-geosearch's osm provider supports searching
- make it more modernize and modularize