2017-11-18 181 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

希望它有帮助!

相关问题