javascript 如何更改 LeafletJS 中的默认加载图块颜色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13851888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I change the default loading tile color in LeafletJS?
提问by thisissami
By default, when leafletJS is loading a map, the background tiles are all grey. I'd like to change that color to be black (or any other arbitrary color). How can I go about doing this?
默认情况下,leafletJS 加载地图时,背景图块都是灰色的。我想将该颜色更改为黑色(或任何其他任意颜色)。我该怎么做呢?
回答by dencey
It's controlled by the below css rule in the file 'leaflet.css':
它由文件“leaflet.css”中的以下 css 规则控制:
.leaflet-container {
background: #ddd;
}
so you just need to change this rule.
所以你只需要改变这个规则。