リーフレットマップ上の単一のボタンをtopleftコーナーに追加するコードが見つかりました。しかし今、私は複数のボタンを次々と追加したいと思っています。複数のカスタムコントロールボタンのチラシを追加する方法js?
次のコード内に複数のボタンを挿入することはできますか?
また、チェックボックス/ラジオボタンを使用しようとしました。しかし、私はどのようにチェックボックスとボタンにラベルを追加するか分からない。
- さらに、チェックされた/選択されていないプロパティを追加します。
ありがとうございます。
ここに私のコード:
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;}});
はい。これの良い例は、描画点、ポリゴン、円などの上に重ねてツールバーのボタンを重ねる 'Leaflet.draw'プラグインです。 – nothingisnecessary