首页 > 解决方案 > Mootools 打破谷歌地图街景 - 黑屏

问题描述

在 Maps JavaScript API Hello World 示例中包含 mootools.min.js 会导致街景功能无法渲染街道图像。我正在使用 Joomla,并且在插入我的代码之前加载了 mootools。

我减少了这个问题,直到我使用文档中提供的 HelloWorld 示例。我本地的 mootools 版本是 1.4.5。我已经使用托管的 1.45 以及最新版本 1.6.0 对其进行了测试。

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/mootools/1.6.0/mootools.min.js"></script>

    <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?key=YOUR_API_KEY_HERE&callback=initMap"
    async defer></script>
  </body>
</html>

将街景人放到街道网络后,我看到两个控制台错误:

获取关于:无效的网络::ERR_UNKNOWN_URL_SCHEME

获取https://example.com/%5Bobject%20Array%20Iterator%5D?panoid=hDKgn2F54H80bzAQMu1LoQ&output=tile&x=0&y=0&zoom=0&nbt&fover=2 404(未找到)

街景界面似乎正在工作 - 导航箭头显示并可点击,只是没有图像。

标签: google-maps-api-3mootoolsgoogle-street-view

解决方案


推荐阅读