I have this basemap selection panel:
// Basemap selection
var baseMaps = L.control.layers({
'Grey Canvas': L.mapbox.tileLayer('mapbox.light').addTo(map),
'Dark Canvas': L.mapbox.tileLayer('mapbox.dark'),
'Street Canvas': L.mapbox.tileLayer('mapbox.streets'),
'Simple Canvas': L.mapbox.tileLayer('mapbox.streets-basic'),
'Emerald Canvas': L.mapbox.tileLayer('mapbox.outdoors')
}).addTo(map);
// Add cartoDB layer, default is checked on
var cdb_layer = cartodb.createLayer(map, 'LINK')
.addTo(map).on('done', function(layer) {
baseMaps.addOverlay(layer, 'Population');
});
// Add population density or other layers, default check is off
var cdb_layer2 = cartodb.createLayer(map, 'LINK', {
legends: false
})
.on('done', function(layer) {
baseMaps.addOverlay(layer, 'Population Density');
});
})
The first section in the panel lets the user choose a mapbox basemap, the second section are 2 cartodb layers. Currently, when one box is checked, the other can also be checked. How do I make it so that when one box is checked, the other turns off and when the other box is checked, the current checked box turns off?
Thanks a lot.