I'm trying to display user location on a leaflet map.
I've searched and researched and still could not implement the code properly I've tried using:
navigator.geolocation.getCurrentPosition(getPosition)
but I must not be implementing code correctly. here is my code for the leaflet map. please show how I can make it show user location instead of fixed coordinate
<div class="text-block">
<h5 class="mb-4">Listing location</h5>
<div class="map-wrapper-300 mb-3">
<div class="h-100" id="detailMap"></div>
</div>
</div>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" integrity="sha512-
GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""></script>
<!-- Available tile layers-->
<script src="/js/map-layers.js"></script>
<script src="/js/map-detail.js"></script>
<script>
createDetailMap({
mapId: 'detailMap',
mapZoom: 14,
mapCenter: [26.3750, -80.1011],
circleShow: true,
circlePosition: [26.3750, -80.1011]
})
</script>
please help and provide code if possible! thank you