Created
September 30, 2020 15:11
-
-
Save letswritetw/6fc4294370f2fdf16e81686fbd3655f6 to your computer and use it in GitHub Desktop.
leaflet-osm-basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const popup = L.popup(); | |
function onMapClick(e) { | |
let lat = e.latlng.lat; // 緯度 | |
let lng = e.latlng.lng; // 經度 | |
popup | |
.setLatLng(e.latlng) | |
.setContent(`緯度:${lat}<br/>經度:${lng}`) | |
.openOn(map); | |
} | |
map.on('click', onMapClick); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment