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
| function initialize() {
map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 17,
center: new google.maps.LatLng(48.858565, 2.347198),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
}
if (navigator.geolocation){
var watchId = navigator.geolocation.watchPosition(successCallback, null, {enableHighAccuracy:true});
} else {
alert("Votre navigateur ne prend pas en compte la géolocalisation HTML5");
}
function successCallback(position){
markLatitude = position.coords.latitude;
markLongitude = position.coords.longitude;
map.panTo(new google.maps.LatLng(markLatitude, markLongitude));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(markLatitude, markLongitude),
map: map
});
}; |
Partager