Remove shadow from standard marker on booklet cards?

Is it possible to remove a shadow from a standard marker in leaflet maps?

+6
source share
2 answers

The source code for new L.Icon.Default() uses: https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Marker.js#L10

Thus, this can be achieved as follows:

 var icon = new L.Icon.Default(); icon.options.shadowSize = [0,0]; var marker = new L.Marker(map.getCenter(), {icon : icon}).addTo(MyMap); 
+5
source

If you just want a simpler, lighter icon, try using divIcon :

 var myIcon = L.divIcon({className: 'my-div-icon'}); // you can set .my-div-icon styles in CSS L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); 
+1
source

Source: https://habr.com/ru/post/970131/


All Articles