Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Created May 13, 2015 13:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stefanocudini/a5cde3c11c9b1f277368 to your computer and use it in GitHub Desktop.
Save stefanocudini/a5cde3c11c9b1f277368 to your computer and use it in GitHub Desktop.
leaflet reset zoom button
(function() {
var control = new L.Control({position:'topright'});
control.onAdd = function(map) {
var azoom = L.DomUtil.create('a','resetzoom');
azoom.innerHTML = "[Reset Zoom]";
L.DomEvent
.disableClickPropagation(azoom)
.addListener(azoom, 'click', function() {
map.setView(map.options.center, map.options.zoom);
},azoom);
return azoom;
};
return control;
}())
.addTo(map);
@rapindrive
Copy link

Thanks, working perfect!

@devTracetec
Copy link

Thx a lot! working perfect!

@xerestel
Copy link

Thanks Sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment