2013-08-02 53 views
0

我需要去除我的谷歌地圖。我用stylers,他們不工作。這裏是我的代碼:谷歌地圖的造型師不起作用?

  <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> 
      <script type="text/javascript"> 
       document.write('<div id="gmap" style="width:960px; height:360px;"></div>'); 
       var map_center = new google.maps.LatLng(xxx, xxx); 
       var map = new google.maps.Map(document.getElementById("gmap"), { 
        zoom: 11, 
        center: map_center, 
        mapTypeId: google.maps.MapTypeId.ROADMAP, 
        panControl: false, 
        streetViewControl: false, 
        mapTypeControl: false, 
        stylers: [ 
         { visibility: "on" }, 
         { saturation: -100 } 
        ] 
       }); 

       var pos; 
       var marker; 
       for(var i = 0 ; i < 10 ; i++) { 
        pos = new google.maps.LatLng(xxx, xxx); 
        marker = new google.maps.Marker({ 
         position: pos, 
         map: map, 
         title: 'Tu jesteśmy', 
         icon: 'pointer.png' 
        }); 
       } 

      </script> 

請注意,我也需要使用自定義指針。

回答

1

沒有MapOption造型師。它是風格。

  var map = new google.maps.Map(document.getElementById("gmap"), { 
       zoom: 11, 
       center: map_center, 
       mapTypeId: google.maps.MapTypeId.ROADMAP, 
       panControl: false, 
       streetViewControl: false, 
       mapTypeControl: false, 
       styles: [ 
       { 
        featureType: 'all', 
        elementType: 'all', 
        stylers: [ 
        { visibility: "on" }, 
        { saturation: -100 } 
        ] 
       }] 
      }); 

working example

+0

偉大的作品,但它缺少的指針現在。 –

+0

你拿出代碼來創建它們嗎?他們不會顯示在我的地圖上,因爲我沒有本地圖標(當我註釋掉這個定義時,他們顯示出來,不知道在同一位置10個標記是多麼有用......)。 – geocodezip