2

如果我单击标记群集,它不会显示带有标题的标记。这是我的测试代码...

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title></title>
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=-my-key-&sensor=false"></script>
    <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js"></script>
    <script type="text/javascript">
      var map;
      var myCenter = new google.maps.LatLng(55.34943850000000, 11.12281580000000);

      var customers = [
        ['Place1', 55.34943850000000, 11.12281580000000],
        ['Place2', 55.34943850000000, 11.22281580000001]
      ];


      function initialize() {
        geocoder = new google.maps.Geocoder();
        var myOptions = {
          zoom: 7,
          center: myCenter,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        setMarkers(map);
      }

      function setMarkers(map) {
        var markers = [];

        for (var i = 0; i < customers.length; i++) {
          var customer = customers[i];
          var myLatLng = new google.maps.LatLng(customer[1], customer[2]);
          var marker = new google.maps.Marker({
            position: myLatLng,
            map: map,
            title: customer[0]
          });
          markers.push(marker);
        }

        var CLUSTER_MINIMUM_SIZE = 1;
        var markerCluster = new MarkerClusterer(map, markers, { minimumClusterSize: CLUSTER_MINIMUM_SIZE });
      }

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

    </script>
  </head>
  <body>
    <div id="map_canvas"></div>
  </body>
</html>

知道我做错了什么或 MarkerCluster 中存在错误吗?

谢谢魔乔

4

0 回答 0