2015-03-02 63 views
0

我遇到了默認標記的問題,它在縮小時似乎會偏移。我在這裏有一個很好的看看,但只能找到自定義標記圖像的答案,並設置圖像上的錨點。我正在使用谷歌的默認標記圖像。Google Maps API - 縮小時默認標記不準確

http://thecompleteanimaldirectory.com

這是有問題的網站,你會發現,一旦你縮小,例如在白島的客戶將在德國結束了書中的地圖將是不準確的!

但是,在這個頁面上,地圖是準確的。

http://www.thecompleteanimaldirectory.com/search.php?category=dog&area=

geocoder = new google.maps.Geocoder(); 
           var mapOptions = { 
            center: { lat: 32.00, lng: 15.00}, 
            zoom: 8 
           }; 


           function initialize() { 
            var map20 = new google.maps.Map(document.getElementById("map_canvas_barrie"), mapOptions); 

            function codeAddress20() { 
             var address20 = "11 Ashey Park, Ashey Road Ryde, I.O.W, PO33 4AL"; 


             geocoder.geocode({ "address": address20}, function(results, status) { 
              if (status == google.maps.GeocoderStatus.OK) { 
               map20.setCenter(results[0].geometry.location); 
               var marker20 = new google.maps.Marker({ 
                map: map20, 
                position: results[0].geometry.location, 
               }); 
              } else { 
               map20.setZoom(0); 
              } 
             }); 
            } 
            codeAddress20(); 

代碼是兩個頁面相同,至於樣式地圖兩個頁面,但沒有運氣在同我去了。任何幫助表示讚賞!

+0

請提供[* *最小**,完整,測試和可讀的示例](http://stackoverflow.com/help/mcve),說明問題。 – geocodezip 2015-03-02 16:09:23

回答

1

這是一個CSS問題。

問題的來源是這樣的規則的main.css,這也適用於圖像地圖:

 .booklet .b-wrap-right img, 
     #book-right-side img { 
      position: absolute; 
      bottom: 10px; 
      right: 15px; 
      height: 30px; 
     } 

添加此規則來覆蓋它:

.right-book .gm-style img{ 
      bottom: 0; 
      right: 0; 
      position:relative; 
      height:auto; 
    } 
相關問題