我試圖更改此Google地圖實例的飽和度。除飽和風格外,其他所有工作都在進行中。我究竟做錯了什麼 ?似乎無法將樣式應用於Google MAP API
代碼:
$(function() { // when the document is ready to be manipulated.
if (GBrowserIsCompatible()) { // if the browser is compatible with Google Map's
var map = document.getElementById("myMap"); // Get div element
var m = new GMap2(map); // new instance of the GMap2 class and pass in our div location.
m.setCenter(new GLatLng(59.334951,18.088598), 13); // pass in latitude, longitude, and zoom level.
m.openInfoWindow(m.getCenter(), document.createTextNode("Looking Good")); // displays the text
m.setMapType(G_NORMAL_MAP); // sets the default mode. G_NORMAL_MAP, G_HYBRID_MAP
// var c = new GMapTypeControl(); // switch map modes
// m.addControl(c);
// m.addControl(new GLargeMapControl()); // creates the zoom feature
var styleArray = [
{
featureType: "all",
stylers: [
{saturation: -80}
]
}
];
}
else {
alert("Upgrade your browser, man!");
}
});
我一直在尋找了一整天(和失敗),以找到一個解決這個問題。
嗨肖娜,沒了,但我想將它添加貝婁風格,在結果 像這樣沒有變化: VAR styleArray = [ { 類型特徵: 「所有」, 造型器:[ {飽和度: -80} ] } ]; m.setOptions({styles:styleArray}); – user2132052 2013-03-04 14:46:44
檢查您的瀏覽器的開發人員工具控制檯,看看是否有任何JS錯誤。 – Shauna 2013-03-04 14:50:07