How to zoom in map in OpenLayerss 3 on click of button?
I want to zoom in and zoom out the map on custom buttons instead of + and - buttons which are on default map.
I tried with:
onclick="map.zoomIn();"
But it's not working, though it was working in OpenLayers 2.
Answer
If you want to zoom in if you click on the map the following should work:
map.on('click', function() {
map.getView().setZoom(map.getView().getZoom()+1);
});
No comments:
Post a Comment