谷歌地图api - 不需要的透明边框

时间:2013-11-26 17:03:11

标签: javascript json api google-maps google-maps-api-3

此示例后面跟着:https://developers.google.com/maps/documentation/javascript/examples/maptype-styled-simple

并定制了一个

我的HTML(几乎相同,主要差异是 var feartureOpts var mapOtions ):

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

<script>
   var map;
   var brooklyn = new google.maps.LatLng(52.330394, -23.661259);

   var MY_MAPTYPE_ID = 'custom_style';

   function initialize() {

     var featureOpts = [
       {
         stylers: [
           { gamma: 1.56 },
           { lightness: 25 },
           { saturation: -100 }
         ]
       }
     ];

     var mapOptions = {
       zoom: 17,
       disableDefaultUI: true,
       center: brooklyn,
       mapTypeControlOptions: {
         mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID]
       },
       mapTypeId: MY_MAPTYPE_ID
     };

     map = new google.maps.Map(document.getElementById('map-canvas'),
         mapOptions);

     var styledMapOptions = {
       name: 'Custom Style'
     };

     var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions);

     map.mapTypes.set(MY_MAPTYPE_ID, customMapType);
   }

   google.maps.event.addDomListener(window, 'load', initialize);

</script>

<div id="map-canvas" style="witdh: 100%; height: 350px;"></div>

结果:enter image description here




问题:如何删除那些令人讨厌的半透明方形边框?

1 个答案:

答案 0 :(得分:0)

请参阅以下链接。

http://jsfiddle.net/x5xXc/

<div id="map-canvas" style="witdh: 400px; height: 350px;"></div>
   var featureOpts = [
       {
         stylers: [
           { gamma: 1.56 },
           { lightness: 25 },
           { saturation: -100 }
         ]
       }
     ];