Skip to content

Instantly share code, notes, and snippets.

@rwoloszyn
Created June 27, 2016 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwoloszyn/5e755eff47085f101c8c0ec97d8755cd to your computer and use it in GitHub Desktop.
Save rwoloszyn/5e755eff47085f101c8c0ec97d8755cd to your computer and use it in GitHub Desktop.
Place control in top of ZoomControl in Leaflet
map.zoomControl.removeFrom(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"/>Auto fit bounds</form>';
return div;
};
autoZoomCheckbox.addTo(map);
map.zoomControl.addTo(map);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment