【发布时间】:2016-08-02 11:27:37
【问题描述】:
我找到了将传单地图上的单个按钮添加到左上角的代码。但是现在我想一个接一个地添加多个按钮。
是否可以在下面的代码中插入多个按钮?
我也尝试过使用复选框/单选按钮。但我不知道如何为复选框和按钮添加标签。
- 并为它们添加选中/未选中的属性。
谢谢。
我的代码在这里:
var customControl = L.Control.extend({ options: {position: 'topleft'},onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom');
onAdd: function (map) {
var container = L.DomUtil.create('input','my-button btn');
container.type="button";
container.title="x";
container.value = "x";
container.label = "x";
container.style.backgroundColor = 'white';
container.style.backgroundSize = "30px 30px";
container.style.width = '40px';
container.style.height = '40px';
container.style.borderRadius = "25px";
container.style.padding = "0";
container.style.margin = "10px";
container.onclick = function(){
console.log('buttonClicked');
}
return container;}});
【问题讨论】:
标签: javascript leaflet custom-controls