This is an example of how opacity can be changed for a Mapbox.JS map: https://www.mapbox.com/mapbox.js/example/v1.0.0/opacity/
The example shows only one layer used.
With barely any experience in JavaScript, h*ow would I go about changing the opacity of the active base layer, if I have multiple of them?*
I have this now:
L.control.layers({
'Name of layer': L.tileLayer('/tiles1/z{z}/{y}/{x}.png').addTo(map),
'Name of other layer': L.tileLayer('/tiles2/z{z}/{y}/{x}.png')
}).addTo(map);
How to correctly set the variable to the selected layer?