1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
var map;
function load(longitude, latitude, zoom) {
var myOptions = {
center: new google.maps.LatLng(longitude,latitude),
zoom: zoom,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var url = "realEstateGoogle.php";
downloadUrl(url, function(data) {
var markers = data.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = add_marker(point,name,address,type);
marker.setMap(map);
}
});
$('#over_map_loading').fadeOut(1600, "linear", "complete");
}
function add_marker(point,name,address,type) {
var infowindow = new google.maps.InfoWindow({ content: 'Allo' });
var marker = new google.maps.Marker({
position: point,
map: map,
title: name,
icon:customIcons[type]
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(type);
infowindow.open(map, marker);
});
return marker;
} |
Partager