To have leaflet.js control do anything by clicking the control input checkbox, I did this way, to bypass to the singular structure of DOM (may label tags, inside the checkbox):
$('.leaflet-control-layers-overlays > label').on('click', function () {
$('.leaflet-control-layers-overlays > label').each(function(i) {
if ($(this).find('input:checkbox').is(':checked') ){
$('div#div_legenda' + i).fadeIn('slow');
}else{
$('div#div_legenda' + i).fadeOut('slow');
}
});
});
Nessun commento:
Posta un commento