作者:永远的爱ye | 来源:互联网 | 2022-12-05 20:28
1> kboul..:
您可以使用超棒的字体图标,而不是像这样的内置标记图标:
const fOntAwesomeIcon= L.divIcon({
html: '',
iconSize: [20, 20],
className: 'myDivIcon'
});
L.marker([51.5, -0.09],{ icon: fontAwesomeIcon}).addTo(map)
.bindPopup('A pretty CSS3 popup.
Easily customizable.')
const fOntAwesomeIcon= L.divIcon({
html: '',
iconSize: [20, 20],
className: 'myDivIcon'
});
L.marker([51.5, -0.09],{ icon: fontAwesomeIcon}).addTo(map)
.bindPopup('A pretty CSS3 popup.
Easily customizable.')
const map = L.map('mapid').setView([51.505, -0.09], 8);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
const fOntAwesomeIcon= L.divIcon({
html: '',
iconSize: [20, 20],
className: 'myDivIcon'
});
L.marker([51.5, -0.09], {
icon: fontAwesomeIcon
}).addTo(map)
.bindPopup('A pretty CSS3 popup.
Easily customizable.')
#mapid {
height: 100vh;
}
body {
margin: 0px;
}
.leaflet-popup-close-button {
display: none;
}
.myDivIcon {
text-align: center;
/* Horizontally center the text (icon) */
line-height: 20px;
/* Vertically center the text (icon) */
}