2017-11-18 178 views
0

enter image description here如何更改標記彈出/工具提示的位置,左邊還是右邊?

標記顯示在TOP位置。 我們如何顯示左邊位置或右邊位置?

這是我的代碼,請檢查一下。

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&amp;sensor=false"></script> 
<script type="text/javascript" src="markerwithlabel.js"></script> 
<script type="text/javascript"> 
    function initMap() { 
    var locations = [ 
     ['Manly Beach', -33.800, 151.287, 'BMW-4', 'marker_blue.png'], 
     ['Maroubra Beach', -33.950198, 151.259302, 'BMW-5', 'default_marker.png'] 
    ]; 
    var latLng = new google.maps.LatLng(-33.92, 151.25); 
    var map = new google.maps.Map(document.getElementById('map_canvas'), { 
     zoom: 12, 
     center: latLng, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    }); 
    var infowindow = new google.maps.InfoWindow(); 
    for (i = 0; i < locations.length; i++) { 
     var marker1 = new MarkerWithLabel({ 
     position: new google.maps.LatLng(locations[i][1], locations[i][2]), 
     map: map, labelContent: locations[i][3], labelAnchor: new google.maps.Point(22, 0), 
     labelClass: "labels", labelStyle: {opacity: 0.75}, icon: locations[i][4] 
     }); 
     google.maps.event.addListener(marker1, 'click', (function(marker, i) { 
     return function() { 
      infowindow.setContent(locations[i][0]); 
      infowindow.open(map, marker); 
     } 
     })(marker1, i)); 
    } 
    } 
</script> 
+0

你說的你的意思是「希望的顯示標記彈出在向左或向右」? – geocodezip

回答

1

你所談論的Google Maps Javascript API Info Windows。目前,您無法更改信息窗口的位置。但是,您可以設計/定製您的信息窗口。您可以使用InfoBubble5 ways to customize Google Maps InfoWindow

您可能想看看這篇文章Styling Google Maps InfoWindow

您可以在Google Public Issue Tracker文件爲功能要求。只需提供有關此請求的足夠細節。

問題跟蹤器是Google在內部使用的一種工具,用於跟蹤產品開發過程中的錯誤和 功能請求。這是谷歌提供的外 通過誰需要 對具體項目谷歌團隊協作的外部公衆和合作夥伴的用戶使用。

要了解更多信息,可以查詢Issue Tracker

希望它有幫助!

相關問題