map location
This commit is contained in:
@ -460,6 +460,33 @@
|
|||||||
attribution: '© OpenStreetMap contributors',
|
attribution: '© OpenStreetMap contributors',
|
||||||
maxZoom: 19
|
maxZoom: 19
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
|
// Try to get user's location
|
||||||
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
(position) => {
|
||||||
|
const lat = position.coords.latitude;
|
||||||
|
const lon = position.coords.longitude;
|
||||||
|
|
||||||
|
// Add user location marker
|
||||||
|
const userIcon = L.divIcon({
|
||||||
|
html: '<div style="width: 16px; height: 16px; background: #0ea5e9; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 10px rgba(14, 165, 233, 0.6);"></div>',
|
||||||
|
className: '',
|
||||||
|
iconSize: [16, 16],
|
||||||
|
iconAnchor: [8, 8]
|
||||||
|
});
|
||||||
|
|
||||||
|
L.marker([lat, lon], { icon: userIcon })
|
||||||
|
.addTo(map)
|
||||||
|
.bindPopup('<div style="background: #1a1a1a; color: #e0e0e0; padding: 8px;"><strong>Dein Standort</strong></div>');
|
||||||
|
|
||||||
|
console.log('User location:', lat, lon);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.log('Geolocation error:', error.message);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show status message
|
// Show status message
|
||||||
|
|||||||
Reference in New Issue
Block a user