2013-11-26 29 views
0

應用css3縮放屬性後,Google地圖引腳點擊不起作用。我無法點擊它。應用css3縮放屬性後,Google地圖引腳點擊不起作用

我想應用縮放屬性。

 <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> 
      <script> 
    // This example displays a marker at the center of Australia. 
    // When the user clicks the marker, an info window opens. 

    function initialize() { 
     var myLatlng = new google.maps.LatLng(-25.363882,131.044922); 
     var mapOptions = { 
      zoom: 4, 
      center: myLatlng 
     }; 

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

     var contentString = '<div id="content">'+ 
       '<div id="siteNotice">'+ 
       '</div>'+ 
       '<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+ 
       '<div id="bodyContent">'+ 
       '<p><b>Uluru</b>,</p>'+ 
       '</div>'+ 
       '</div>'; 

     var infowindow = new google.maps.InfoWindow({ 
       content: contentString 
     }); 

     var marker = new google.maps.Marker({ 
       position: myLatlng, 
       map: map, 
       title: 'Uluru (Ayers Rock)' 
     }); 
     google.maps.event.addListener(marker, 'click', function() { 
      infowindow.open(map,marker); 
     }); 
    } 

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

      </script> 
    <style> 
    html, body, #map-canvas { 
        height: 100%; 
        margin: 0px; 
        padding: 0px 
       } 

    #map-canvas{ 
      zoom: 0.7; 
      -moz-transform: scale(0.7); 
      -webkit-transform: scale(0.7); 

    } 
    </style> 
     <body> 
      <div id="map-canvas"></div> 
     </body> 

誰能告訴我爲什麼我沒有申請CSS3 zoom屬性後得到手形指針。

+0

[jsfiddle link](http://jsfiddle.net/BHhrF/) – Pavan

回答

0

請參考鏈接。 http://jsfiddle.net/6TkY4/1/

var mapOptions = { 
        center: new google.maps.LatLng(latitude, longitude), 
         zoom: 8, 
        mapTypeId: google.maps.MapTypeId.ROADMAP 

       }; 

If you want to change zoom size, then increase zoom property value in mapOptions. 

也請參閱您的提琴例如現在的作品。

http://jsfiddle.net/BHhrF/1/

不要設置%值DIV高度。請使用像素值。或者使用帶有像素的外部div。內部div高度(%)。它會工作。

+0

你能告訴我們應用css3縮放屬性有什麼問題嗎? – Pavan

+0

這裏需要什麼zoom屬性?如果你想要地圖縮放,那麼使用地圖縮放屬性。它也會增加d​​iv縮放屬性。 – RGS

+0

因此,確切的情況是,當用戶放大頁面時,我想調整地圖的大小,使其看起來與頁面未縮放(縮放級別1)時完全相同。即使我更改地圖縮放屬性,地圖控件和其他字體將以放大狀態進入,這就是爲什麼我要使用CSS縮放或CSS縮放的原因。 – Pavan