admin管理员组

文章数量:1418138

I want to use the leaflet AwesomeMarkers (.awesome-markers). However there is no possibility to not set a marker color. That means, I just want to have the icon on the map, with a transparent markerColor.

Anyone knows how to do that?

I want to use the leaflet AwesomeMarkers (https://github./lvoogdt/Leaflet.awesome-markers). However there is no possibility to not set a marker color. That means, I just want to have the icon on the map, with a transparent markerColor.

Anyone knows how to do that?

Share Improve this question asked Feb 10, 2016 at 10:49 threxxthrexx 1,2352 gold badges32 silver badges61 bronze badges 1
  • you can use opacity also in div tag and prevent css apply to child tag..It will give u transparent background – Dhara Commented Feb 10, 2016 at 11:15
Add a ment  | 

2 Answers 2

Reset to default 4

Here's a fiddle that leaves out the color:

http://jsfiddle/VPzu4/861/

I've set the markerColor to transparent which results in the marker getting the class awesome-marker-icon-transparent and then I've defined my own style for that class which just removes the background for the icon.

Note that this will probably break something if Leaflet.awesome-markers ever decides to use the transparent keyword in a different way.

Update:

To get rid of the shadow you could hide the entire leaflet-shadow-pane by css but that would hide all the shadows.

To set the size of the marker you can try applying more css rules to awesome-marker-icon-transparent or you can pass in the extraClasses property which is used to add classes to the icon element.

There's also the possibility that one of the 160 forks in GitHub already does what you want.

for @vue-leaflet/vue-leaflet packet in Vue 3. @vue-leaflet/vue-leaflet version is 0.10.1.

.leaflet-div-icon {
  background: none !important;
  border: none !important;
}

本文标签: javascriptset markerColor of leaflet AwesomeMarkers to 39nonetransparent39Stack Overflow