加载地图时收到错误消息。但是,当地图失败时,我希望“ MAP”选项以取消状态显示,即不可点击。我怎样才能做到这一点
$('.leaflet-control-layers').text("MAP").hide();// I tried this way but they all disappeared
mywms.on("tileerror", function () {
map.removeLayer(mywms);
alert("ERROR)")
var mywms2 = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 17,
})
map.addLayer(mywms2);
});
根据您的条件,您可以执行此操作,只需添加disbale属性和CSS text-decoration: line-through;
$(document).ready(function(){
$('#check').attr("disabled", true);
$('#check + label').css("text-decoration","line-through");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="map">
<input type="checkbox" id="check">
<label for="check">Map</label>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句