Skip to content

Commit

Permalink
Update click.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Hokite authored Nov 6, 2023
1 parent cfd1566 commit 5ce6aba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions click.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@
};

var map = new kakao.maps.Map(mapContainer, options);
var markers = []; // 마커 배열

kakao.maps.event.addListener(map, 'click', function(mouseEvent) {
var latlng = mouseEvent.latLng;
var lat = latlng.getLat();
var lng = latlng.getLng();

var marker = new kakao.maps.Marker({
position: latlng
});

marker.setMap(map);
markers.push(marker);

alert('클릭한 위치 - 위도: ' + lat + ', 경도: ' + lng);
});
</script>
Expand Down

0 comments on commit 5ce6aba

Please sign in to comment.