I'm using custom divIcons for my Leaflet markers. I want to add a border to whatever marker I click on, with some simple CSS:
.selectedMarker {
border: 10px solid gold;
}
However, the following with jQuery doesn't work:
$(marker).addClass('selectedMarker');
Then I tried to use Leaflet's own addClass() method. I tried to call use it in the following ways:
marker.addClass('selectedMarker');
L.addClass(marker, 'selectedMarker');
addClass(marker, 'selectedMarker');
DomUtil.addClass(marker, 'selectedMarker');
None of these work. How do I add the selectedMarker class to my marker?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…