admin管理员组文章数量:1208155
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());
});
本文标签: javascriptGet zoom size on Google Map APIStack Overflow
版权声明:本文标题:javascript - Get zoom size on Google Map API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738760253a2110916.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论