我有地图但有冲突。当我单击或缩放标记时,所有标记都会消失。但是,当我删除标记clusterer所有罚款,但这么多标记。我使用geolocation-marker.js& markerclusterer.js。这个问题的任何想法?感谢
我的HTML
<div style="width:100%; height:100%;">
<div id="map">
<span style="color:Gray;">
<img style="margin: 0px auto; display: block; width: 50%;" src="images/circle-loading-animation.gif"></img>
</span>
</div> </div>
</div><!-- Map Ends display -->
这是我的Java脚本地理定位标记
GeoMarker = new GeolocationMarker();
GeoMarker.setCircleOptions({fillColor: '#808080'});
google.maps.event.addListenerOnce(GeoMarker, 'position_changed', function() {
map.setCenter(this.getPosition());
map.fitBounds(this.getBounds());
});
//marker follow & center screen
navigator.geolocation.watchPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var geolocpoint = new google.maps.LatLng(latitude, longitude);
map.setCenter(geolocpoint);
});
google.maps.event.addListener(GeoMarker, 'geolocation_error', function(e) {
alert('There was an error obtaining your position. Message: ' + e.message);
});
GeoMarker.setMap(map);
这是我的脚本markerclusterer
//markerCluster
var mcOptions = {
gridSize: 50,
maxZoom: 15
};
var markerCluster = new MarkerClusterer(map, [], mcOptions);
.....................................................
....................................................
markerCluster.addMarker(marker, true);
答案 0 :(得分:0)
我找到了冲突,这是因为我将<script src="https://maps.googleapis.com/maps/api/js"></script>
添加到头部。当我点击或缩放标记时,所有标记都会消失。但是,当我将上面的网址更改为script src="http://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&sensor=true"></script>
时,所有标记都没问题。
由于