传单L.控制.归属

leaflet L.control.attribution

本文关键字:归属 控制 传单      更新时间:2023-09-26

感谢您在这里提供帮助。我已经构建了一个MapBox应用程序。我想在MapBox的版权徽标之前添加版权。我使用 L.control.attribution 作为:

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

我使用FireFox检查器发现some text是->来自传单.css的div class="leaflet-control-attribution leaflet-control"的孩子。

我有自己的自定义.css文件,我试图使用它来覆盖传单中的类传单控制归因.css但它不起作用。这是来自MapBox的东西.css以防止覆盖还是传单?有没有解决这个问题的解决方案?我只是想更改 L.control.attribution DOM 对象的父div 的背景。

提前谢谢。

艾哈迈德

你可以

通过这种方式做到这一点

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

你可以传递一个html文本来代替"sometext"。

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

传单控制归因可能被覆盖了。 尝试将"!important"添加到 CSS 属性中。