Html code for adding map
<div id="map" style="height:480px; width:360px;"></div>
css for loading map
.leaflet-div-icon
{
background-image: url('http://cloudmade.com/images/layout/cm-logo.png');
}
Logic for changing marker colour
var map = L.map('map').setView([51.5, -0.09], 13);
L.marker([51.49, -0.09]).addTo(map)
.bindPopup('Demo CSS3 popup. <br> Easily customizable.');
const myCustomColour = '#5f93ed'
const markerHtmlStyles = `
background-color: ${myCustomColour};
width: 15px;
height: 15px;
font-size:15px;
text-align:center;
display: block;
`
function thing(ct) {
return L.divIcon({
className: "box",
iconAnchor: [12, 25],
labelAnchor: [-6, 0],
popupAnchor: [0, -15],
html: `<span style="${markerHtmlStyles}" >M</span>`
})
}
L.marker([51.51, -0.09], {
icon: thing("hello")
}).addTo(map)
.bindPopup('divIcon CSS3 popup. <br> Supposed to be easily stylable.');
Html code for adding map
<div id="map" style="height:480px; width:360px;"></div>
css for loading map
.leaflet-div-icon
{
background-image: url('http://cloudmade.com/images/layout/cm-logo.png');
}
Logic for changing marker colour
var map = L.map('map').setView([51.5, -0.09], 13);
L.marker([51.49, -0.09]).addTo(map)
.bindPopup('Demo CSS3 popup. <br> Easily customizable.');
const myCustomColour = '#5f93ed'
const markerHtmlStyles = `
background-color: ${myCustomColour};
width: 15px;
height: 15px;
font-size:15px;
text-align:center;
display: block;
`
function thing(ct) {
return L.divIcon({
className: "box",
iconAnchor: [12, 25],
labelAnchor: [-6, 0],
popupAnchor: [0, -15],
html: `<span style="${markerHtmlStyles}" >M</span>`
})
}
L.marker([51.51, -0.09], {
icon: thing("hello")
}).addTo(map)
.bindPopup('divIcon CSS3 popup. <br> Supposed to be easily stylable.');