Javascript 谷歌地图API-灰度

Javascript 谷歌地图API-灰度,javascript,jquery,google-maps,google-maps-api-3,Javascript,Jquery,Google Maps,Google Maps Api 3,我有下面的代码设置来为各种区域应用地图 var locations = [ ['Liver Office - Liverpool Office', 53.40529, -2.988801, 1], ['Lond office - London Office', 51.515026, -0.086811, 2], ]; function plotMap(loc) { var mapOptions = { zoom: 17, center: new google.ma

我有下面的代码设置来为各种区域应用地图

var locations = [
  ['Liver Office - Liverpool Office', 53.40529, -2.988801, 1],
  ['Lond office - London Office', 51.515026, -0.086811, 2],

];
function plotMap(loc) {  

var mapOptions = {
    zoom: 17,
    center: new google.maps.LatLng((locations[loc][1]), (locations[loc][2])),
    stylers: [
    { saturation: -100 } // <-- THIS
  ]
};

var map = new google.maps.Map(document.getElementById('map'),

  mapOptions);

var marker = new google.maps.Marker({
    position: map.getCenter(),
    map: map,
     mapTypeControlOptions: {
     mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'tehgrayz']
    },
    icon: 'marketICO.png',
    title: (locations[loc][0])
});

var infowindow = new google.maps.InfoWindow();
    google.maps.event.addListener(marker, 'click', (function(marker) {
    return function() {
      infowindow.setContent(locations[loc][0]);
      infowindow.open(map, marker);
    }
  })(marker, loc));
}

$('.livLink').click(function(){
    plotMap(0);
});
$('.lonLink').click(function(){
    plotMap(1);
});
    plotMap(0);
var位置=[
[Liver办事处-利物浦办事处,53.40529,-2.988801,1],
[“伦敦办事处-伦敦办事处”,51.515026,-0.086811,2],
];
函数绘图图(loc){
变量映射选项={
缩放:17,
中心:新的google.maps.LatLng((位置[loc][1]),(位置[loc][2]),
样式:[

{饱和度:-100}/您没有正确应用样式

var styles = [{
    "stylers": [{
        "saturation": -100
    }]
}];

var mapOptions = {
    zoom: 17,
    styles: styles,
    // your other options here
};
或直接在地图选项中:

var mapOptions = {
    zoom: 17,
    styles: [{
        "stylers": [{
            "saturation": -100
        }]
    }],
    // your other options here
};

检查这个不错的工具:

我建议把第二个问题作为第二个问题来问。这样,你可能会对每个问题都有更好的回答。要点:我已经提出了第二个问题-