leaflet L.control.attribution

Ahmad Aburizaiza picture Ahmad Aburizaiza · Feb 22, 2016 · Viewed 7.2k times · Source

Thank you for offering your help here. I have built a MapBox application. I wanted to add a copyright prior to MapBox's copyright logo. I used the L.control.attribution as:

varName = L.control.attribution({prefix: 'some text'}).addTo(map);

I used FireFox inspector and found that some text is a child of -> a div class="leaflet-control-attribution leaflet-control" from leaflet.css.

I have my own custom.css file and I tried to use it to override the class leaflet-control-attribution in leaflet.css but it is not working. Is this something from MapBox.css to prevents overriding or from leaflet? Is there a solution to fix this? I just wanted to change the background of the parent div of the L.control.attribution DOM object.

Thanks in advance.

Ahmad

Answer

pd farhad picture pd farhad · Apr 27, 2016

You can do it by this way

var leafletMap = L.map('map').setView([23.709921, 90.407143], 7);

 leafletMap.attributionControl.addAttribution('Licensed by &copy; <a href="some_link", class="your_class">Habijabi</a>');