Hi, I have integrated google map following this tutorial and works fine but when I touch in a marker and a Popup is showed, if I touch in other mark or position in the map, the previous marker popup is not close. So I have to close every popup manually.
Any idea?
Kind Regards
....
....
var latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
$scope.map = new google.maps.Map(document.getElementById("map"), mapOptions);
google.maps.event.addListenerOnce($scope.map, 'idle', function() {
//My position:
var image = {
url: 'img/myposition.png',
size: new google.maps.Size(32, 32),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(10, 20)
};
var myStyle = {
'background-image': 'url("img/myposition.png")'
};
var myMark = new google.maps.Marker({
map: $scope.map,
animation: google.maps.Animation.DROP,
position: latLng,
icon: image,
options: {
labelAnchor: "36 61",
labelClass: 'labelClassMyPosition',
labelStyle: myStyle,
labelInBackground: false
}
});
var myName = "<h4>" + "You're here" + "</h4>";
addInfoWindow(myMark, myName, myMark);
});
....
....
....
function addInfoWindow(marker, message, record) {
var infoWindow = new google.maps.InfoWindow({
content: message
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.open(map, marker);
});
};