With jVectorMap is it possible to hide zoom buttons and call Zoom In/Out using their API? I've checked the API documentation and couldn't find any methods, causing the map re-zoom.
Sure.
Hide the buttons:
$('#map').vectorMap({
map: 'world_mill_en',
zoomButtons : false
});
Get reference to the map:
map = $("#world-map-gdp").vectorMap('get', 'mapObject');
Set the zoom level:
map.setScale(4);
On a side note, you can also disable/enable zooming on scroll using
zoomOnScroll: false
There's no such feature a this moment. But...
- It seems like someone else asked for an option to hide the zoom buttons, and it is already done but seems not documented, see feature request status: https://github.com/bjornd/jvectormap/pull/136.
- To allow zoom in/out by code you could and should create a feature request via GitHub: https://github.com/bjornd/jvectormap/issues/new
I strongly encourage you to create the feature request so the devs behind the project can actually know what are the real needs.
Edit
Looking trough the mentioned feature request, I can see there is a parameter to hide zoom buttons. So you will need to build your maps passing a zoomButtons
attribute to false
:
$('#map').vectorMap({
map: 'world_mill_en',
zoomButtons : false
});
The other thing you are looking for (zoom in/out via API), I think if you are really sure there's no way to do it, you should create an issue masked as a feature request.
Edit 2
Months after my answer was posted, the feature got released see that answer.
© 2022 - 2024 — McMap. All rights reserved.