2016-11-22 179 views
0

我有写在java脚本中的变量样式,但我不知道在哪里放置它,以便它开始工作。将样式添加到Google Maps API?

我试图把它的功能initmap(内部){..但它不工作。 https://jsfiddle.net/hute2o63/8/ 这里是我的风格:

var featureOpts = [ { "featureType": "landscape", "stylers": [ { "hue": "#FFA800" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#53FF00" }, { "saturation": 0 }, { "lightness": -1.4210854715202004e-14 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FBFF00" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#00FFFD" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#0078FF" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#9FFF00" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] } ]; 

任何帮助吗?

+1

试试这个页面,它可能有所帮助 - https://developers.google.com/maps/documentation/javascript/styling –

+1

展望你的jsfiddle,你在这里没有提供一个有效的API-KEY:'