By using this function, when we will click the marker, a popup will be shown on map. Here we have a function , first we will assign the content to a string name, then we will pass that value to the function .
Watch below:-
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 8,
center: myLatlng
};
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Evon'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
0 Comment(s)