谷歌地图图标不会显示

发布于 2024-11-17 08:07:58 字数 376 浏览 1 评论 0原文

我一生都无法弄清楚为什么我的图标不会显示

      function placeMarker(location) {
          var marker = new google.maps.Marker({
              position: location, 
              map: W.map,
              icon: "/files/icons/maps/beacon_16.png"
          });

          W.map.setCenter(location);
      }

当我注释掉图标行时,它显示标准标记,所以我显然错过了一些东西,但谷歌指南没有帮助如何我应该格式化我的变量

I can't for the life of me figure out why my icon won't show up

      function placeMarker(location) {
          var marker = new google.maps.Marker({
              position: location, 
              map: W.map,
              icon: "/files/icons/maps/beacon_16.png"
          });

          W.map.setCenter(location);
      }

When I comment out the icon line, it shows the standard marker, so I'm obviously missing something but the google guides aren't helping in how I'm supposed to format my variables

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个ˇ局外人 2024-11-24 08:07:58

您应该为图标属性提供绝对 URL,而不是相对路径。

You should provide an absolute URL for the icon attribute rather than relative path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文