Skip to content

Instantly share code, notes, and snippets.

@rwoloszyn
Created June 27, 2016 17:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwoloszyn/e894c3105842a541e659f327292af9ca to your computer and use it in GitHub Desktop.
Save rwoloszyn/e894c3105842a541e659f327292af9ca to your computer and use it in GitHub Desktop.
Add checkbox as control in leaflet map
// create the control
var autoZoomCheckbox = L.control({position: 'topleft'});
autoZoomCheckbox.onAdd = function (map) {
var div = L.DomUtil.create('div', 'command');
div.innerHTML = '<form><input id="command" type="checkbox"/>Automatic fit to bounds</form>';
return div;
};
autoZoomCheckbox.addTo(map);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment