2017-11-28 17 views
0

다음은 Google지도를 전송하는 데 사용하는 코드입니다. 크기가 1095px 인이 경우 크기를 조정하려면 누군가 문제가 발생합니다. 이 경우 Ctrl 키를 누른 상태에서만 마우스 휠을 사용하여 확대/축소 할 수 있습니다. 1150 픽셀로 html min-with를 유지하고 ctrl을 요청하는이 기능을 사용 중지하는 방법이 있습니까?Google지도 - 마우스 스크롤로지도 확대/축소 Ctrl 키를 묻습니다.

옵션 gestureHandling : 'greedy'는 익숙하지만 가능한 경우 다른 방법으로 해결하고 싶습니다. 감사합니다.

<!DOCTYPE html> 
    <html> 
     <head> 
     <title>Simple Map</title> 
     <meta name="viewport" content="initial-scale=1.0"> 
     <meta charset="utf-8"> 
     <style> 
      /* Always set the map height explicitly to define the size of the div 
      * element that contains the map. */ 
      #map { 
      width: 100%; 
      height: 100%; 
      position: fixed !important; 
      left: 0; 
      z-index: 2; 
      top: 0; 
      } 
      /* Optional: Makes the sample page fill the window. */ 
      html, body { 
      height: 100%; 
      min-width:1150px; 
      width: auto; 
      margin: 0; 
      padding: 0; 
      } 
     </style> 
     </head> 
     <body> 
     <div id="map"></div> 
     <script> 
      var map; 
      function initMap() { 
      map = new google.maps.Map(document.getElementById('map'), { 
       center: {lat: -34.397, lng: 150.644}, 
       zoom: 8 
      }); 
      } 
     </script> 
     <script src="https://maps.googleapis.com/maps/api/js?callback=initMap" 
     async defer></script> 
     </body> 
    </html> 

답변

1

지도 변수에 gestureHandling: 'greedy'을 추가하십시오. 그러면 다음과 같이 보입니다.

function initMap() { 
    map = new google.maps.Map(document.getElementById('map'), { 
     center: {lat: -34.397, lng: 150.644}, 
     zoom: 8, 
     gestureHandling: 'greedy' 
    }); 
}