简体   繁体   English

单击超链接时,如何使用Google Maps API v3缩放地图?

[英]How do I zoom my map using Google Maps API v3 when I click a hyperlink?

I can't get to Google Maps API v3 to zoom in/out when I click my hyperlink. 点击我的超链接后,我无法使用Google Maps API v3进行放大/缩小。 I had it working in v2: 我让它在v2中工作:

<a href="javascript:map.setCenter(new GLatLng(58.37,62.66), 16);map.setMapType(G_SATELLITE_MAP);" >Some Place</a>

In v3 I have tried: 在v3中我尝试过:

<a href="javascript:map.setCenter(new google.maps.LatLng(58.37,62.66));">Some Place</a>

How can I resolve this issue? 我该如何解决这个问题?

在v3中,您还必须调用setZoom

<a href="javascript:map.setCenter(new google.maps.LatLng(58.37,62.66));map.setZoom(16);">Some Place</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在自定义地图的名称中添加超链接? 谷歌地图API v3 - How i can add a hyperlink in the name of my custom map? google maps api v3 使用Google Maps Javascript API v3,如何在点击时生成默认的信息框? - Using the Google Maps Javascript API v3, How do I produce the default infoboxes on click? 如何使用Google Maps API V3显示简单的邮政编码地图? - How do I do a simple zip code map showing boundaries with Google Maps API V3? 如何从Google Map API V3获取最新的卫星地图 - how do I get latest satellite maps from Google map api V3 如何在V3 API中访问Google地图制作工具地图? - How do I access Google Map Maker Maps in the V3 API? 如何在Google Fusion Tables中解析我的几何字段以缩放到Google Maps API V3中的多边形坐标? - How can I parse my geometry field in Google Fusion Tables to zoom to polygon coordinates in Google Maps API V3? 如何在 google maps api v3 中创建网格 - How do I create a grid in google maps api v3 如何限制Google Maps API V3中的平移? - How do I limit panning in Google maps API V3? 如何使用google maps api v3突出显示某个国家/地区? - How do I highlight a country with the google maps api v3? 为什么在Google Maps v3上使用MVCObject更改缩放比例后,我的代码无法提醒地图的缩放比例 - why my code can't alert the map's zoom when zoom changed using MVCObject on google-maps v3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM