How can I get the zoom size in google map after changing by mouse wheel or zoom bar ?
I use Google Map API 3 with JavaScript.
I want to show in console.log()
with every change.
How can I get the zoom size in google map after changing by mouse wheel or zoom bar ?
I use Google Map API 3 with JavaScript.
I want to show in console.log()
with every change.
4 Answers
Reset to default 14Easy. As per docs:
google.maps.event.addListener(map, 'zoom_changed', function() {
var z = map.getZoom();
console.log(z);
});
Here's a great utility that shows all the events as they fire.
map.getZoom()
.
It's in the docs!
you can use zoom_changed event for this..
check this link
You have to keep a div that will show the map I am having ('map_canvas').
var map = new google.maps.Map(document.getElementById('map_canvas'), {
disableDefaultUI : true,
zoom : 12,
center : new google.maps.LatLng(17.1312321,78.23123123),
mapTypeId : google.maps.MapTypeId.ROADMAP
});
google.maps.event.addListener(map, 'zoom_changed',function() {
console.log(map.getZoom());
});