Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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