This JSfiddle example currently changes the visibility of a layer using two individual buttons.
However, i want to change this to just one check-box, the check-box in this case has been styled by Bootstrap Check-box.What would be the most simple method to bind the set.visibility command to this?
Edit: I have also tried to do this with a function toggleOSM()
linked the onClick
of the check-box as per this JSFiddle but it doesn't appear to work.
1 Answer 1
Use the onSwitchChange
option of bootstrapSwitch:
$("[name='my-checkbox']").bootstrapSwitch({
onSwitchChange: function (event, state) {
rasterLayer.setVisible(state)
}
});