I’m having an issue with custom markers only displaying on Safari. I can open developer tools in firefox or chrome and see where the marker image is found, but it does not display on the map. Here’s my code.
let element = document.createElement('div')
element.className = 'marker'
element.style.backgroundSize = '20px'
element.style.backgroundRepeat = 'no-repeat'
element.style.backgroundPosition = 'center'
element.style.visibility = 'visible'
if(value.isActive == 'disconnected'){
element.style.backgroundImage = 'url(/img/red_dot.png)'
}
let popupdiv = document.createElement('div')
popupdiv.innerHTML = value.siteName
let popup = new tt.Popup({
closeButton: false,
offset: 30,
anchor: 'bottom'
}).setDOMContent(popupdiv)
var marker = new tt.Marker({element: element})
// var marker = new tt.Marker()
.setLngLat([value.longitude, value.latitude])
.setPopup(popup)
.addTo(map)
and the relevant css
.marker {
background-image: url(‘/img/green_dot.png’);
background-size: cover;
}
Any thoughts?