2016-09-05 4 views
1

Googleマップの右側の下隅にズーム(+)とズームアウト( - )オプションを表示します。私はこれを試みたが、私はズームオプションを取得していない。Googleマップでズームコントロールを追加するには

<script async defer 
      src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDQ2&callback=initMap"> 
    </script> 
    <script type="text/javascript"> 
     window.onload = function() { 
      var mapOptions = { 
       center: new google.maps.LatLng(17.44633567526379, 78.38290556613924), 
       zoom: 14, 
       mapTypeId: google.maps.MapTypeId.ROADMAP 
      }; 
      var infoWindow = new google.maps.InfoWindow(); 
      var latlngbounds = new google.maps.LatLngBounds(); 
      var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions); 
      google.maps.event.addListener(map, 'click', function (e) { 
       alert("Latitude: " + e.latLng.lat() + "\r\nLongitude: " + e.latLng.lng()); 
       document.getElementById("txtLongitude").value = e.latLng.lng(); 
       document.getElementById("txtLatitude").value = e.latLng.lat(); 
      }); 
     } 
    </script> 
    <div id="dvMap" style="width: 700px; height: 300px"> 
    </div> 
+0

[MCVE]必要なHTML/CSSを含め、問題を示すことを提供してください。 [投稿コードで右下隅に+/-ズームイン/アウトコントロールがあります](http://jsfiddle.net/geocodezip/35rsc4je/2/)。 – geocodezip

+0

私は間違いだと思っています。地図の幅をもっと広げてしまったと思います。ズームシンボルは見えません。私が幅を小さくすると、私は愚かな間違いのために記号を残す。 – sanjay

答えて

0

このようなあなたのMapOptionsでzoomControl: trueを追加します。

var mapOptions = { 
       center: new google.maps.LatLng(17.44633567526379, 78.38290556613924), 
       zoomControl: true, 
       zoom: 14, 
       mapTypeId: google.maps.MapTypeId.ROADMAP 
      }; 
関連する問題