Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title>Ma Carte</title>
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB9zyz88xNHoNM2z81OY0ZmJ_WQa45WsOA&callback=initMap" async defer></script>
<script>
let map;
let marker;

function initMap() {
// Initialisation de la carte
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 48.8566, lng: 2.3522 }, // Paris
zoom: 12,
});

// Ajouter un événement de clic sur la carte
map.addListener('click', function(event) {
// Récupérer la position du clic
const latLng = event.latLng;

// Si un marqueur existe déjà, le supprimer
if (marker) {
marker.setMap(null);
}

// Créer un nouveau marqueur rouge à la position du clic
marker = new google.maps.Marker({
position: latLng,
map: map,
icon: {
url: "http://maps.google.com/mapfiles/ms/icons/red-dot.png" // Icône rouge
}
});
});
}
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
25 changes: 0 additions & 25 deletions maps.html

This file was deleted.