Google 地图 API - 缩放按钮不响应鼠标点击
Google Maps API - Zoom Buttons not responding to mouse clicks
我在 FileMaker Web 查看器(使用 FileMaker Pro v16)中使用 Google 地图 API 显示 Google 地图。在 macOS High Sierra 上一切正常,但在另一个 Mac 运行 Sierra 或 El Capitan 上,缩放按钮(出现在右下角的 + 和 - 按钮)在您单击它们时没有响应鼠标。
如果您使用鼠标滑动缩放,效果很好。如果我将 html 从 Web 查看器保存到 .html 文件并在 Safari 中打开,它工作正常,但由于某些原因,缩放按钮不会在这些系统的 Web 查看器中响应。我正在使用地图 API 文档中的基本示例进行测试,如下所示(我正在添加我的 API 密钥,但已从示例代码中删除):
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
async defer></script>
</body>
</html>
我在控制台中没有得到任何东西,所以此时我很困惑为什么在点击地图上的缩放 in/out 按钮时鼠标点击不起作用。
我已经通过指定 API 的先前版本成功解决了这个问题,例如 http://maps.google.com/maps/api/js?v=3.33&key=xxxxxxx
我在 FileMaker Web 查看器(使用 FileMaker Pro v16)中使用 Google 地图 API 显示 Google 地图。在 macOS High Sierra 上一切正常,但在另一个 Mac 运行 Sierra 或 El Capitan 上,缩放按钮(出现在右下角的 + 和 - 按钮)在您单击它们时没有响应鼠标。
如果您使用鼠标滑动缩放,效果很好。如果我将 html 从 Web 查看器保存到 .html 文件并在 Safari 中打开,它工作正常,但由于某些原因,缩放按钮不会在这些系统的 Web 查看器中响应。我正在使用地图 API 文档中的基本示例进行测试,如下所示(我正在添加我的 API 密钥,但已从示例代码中删除):
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
async defer></script>
</body>
</html>
我在控制台中没有得到任何东西,所以此时我很困惑为什么在点击地图上的缩放 in/out 按钮时鼠标点击不起作用。
我已经通过指定 API 的先前版本成功解决了这个问题,例如 http://maps.google.com/maps/api/js?v=3.33&key=xxxxxxx