最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - leaflet L.control.attribution - Stack Overflow

programmeradmin1浏览0评论

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

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

Share Improve this question edited Feb 22, 2016 at 12:26 Alexandr Lazarev 12.9k4 gold badges39 silver badges47 bronze badges asked Feb 22, 2016 at 1:31 Ahmad AburizaizaAhmad Aburizaiza 411 gold badge1 silver badge2 bronze badges 1
  • Provide please your css code with which you have tried to override the class. – Alexandr Lazarev Commented Feb 22, 2016 at 12:28
Add a ment  | 

3 Answers 3

Reset to default 5

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>');

You can pass an html text in place of "sometext".

varName = L.control.attribution({prefix: '<span class="AttributionClass">some text</span>'}).addTo(map);

leaflet-control-attribution is probably getting over-ridden. try adding '!important' to the css attribute.

发布评论

评论列表(0)

  1. 暂无评论