Hello,
I wanted to add infoboxes to my markers on Google Map First, before adding them, all the markers were visible on the map, but after I added the following code the map got lost, only the infoboxes can be seen Here is my code:
else if (allincid != "" && spl.length != 0) {
// alert("spl.length" + spl.length);
var markers = [];
var loc = [];
var infowindow = new google.maps.InfoWindow();
for (var i = 0; i < spl.length; i++) {
var element = spl[i];
var lat = element.substr(0, 9);
var latit = parseFloat(lat);
// alert(latit);
var lon = element.substr(10, 15);
var longit = parseFloat(lon);
// alert(latit + "," + longit);
loc[i] = new google.maps.LatLng(latit, longit);
var marker = new google.maps.Marker({
position: loc[i],
map: map,
title: name1[i],
visible: true
});
boxText = document.createElement("div"),
infoboxOptions = {
content: boxText,
disableAutoPan: false,
maxWidth: 0,
pixelOffset: new google.maps.Size(-60, 0),
zIndex: null,
boxStyle: {
background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat",
opacity: 0.75,
width: "70px"
},
closeBoxMargin: "10px 4px 2px 2px",
closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
infoBoxClearance: new google.maps.Size(1, 1),
isHidden: false,
pane: "floatPane",
enableEventPropagation: false
};
markers.push(marker);
boxText.style.cssText = "border: 1px solid black; margin-top: 4px; text-wrap:unrestricted; background:#f9eef0; color:#000000; font-family:Arial; font-size:10px; padding: 5px; border-radius:6px; -webkit-border-radius:6px; -moz-border-radius:6px;";
boxText.innerHTML = '<div id="content">' + name1[i]+ '</b>';
markers[i].infobox = new InfoBox(infoboxOptions);
markers[i].infobox.open(map, marker);
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
markers[i].infobox.open(map, this);
map.panTo(markerData[i].latLng);
}
})(marker, i));
markers.push(marker);
markers[i].setMap(map);
}
Can anybody help me please how to retrieve the map again?
Thanks