【问题标题】:Google Maps Custom Style won't work谷歌地图自定义样式不起作用
【发布时间】:2013-07-14 12:41:44
【问题描述】:

我目前正在尝试自定义 Google 地图。

我通过 API (http://www.achimsagner.de/test/klysz/) 设置了我的地图样式,但由于我使用了 InfoBox,我的样式不会加载。 (http://www.achimsagner.de/test/gmaps_test.html)

我只是找不到我的错误,也许有人可以帮助我。

【问题讨论】:

    标签: javascript google-maps infobox


    【解决方案1】:

    将样式添加到您的 myMapOptions

     var myMapOptions = {
                    zoom: 16,
                    center: secheltLoc,
                    styles : styles,
                    disableDefaultUI: true,
                    scrollwheel: false          
            }
    

    【讨论】:

    • 谢谢!不知道我怎么想不通。
    【解决方案2】:

    应用该样式的页面包含在不应用该样式的页面上不存在的这些行:

      //Associate the styled map with the MapTypeId and set it to display.
        theMap.mapTypes.set('map_style', styledMap);
        theMap.setMapTypeId('map_style');
    

    working example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-16
      • 2018-01-04
      • 1970-01-01
      • 2012-07-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多