1

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.

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Sep 19, 2015 at 15:47

1 Answer 1

1

Use the onSwitchChange option of bootstrapSwitch:

$("[name='my-checkbox']").bootstrapSwitch({
 onSwitchChange: function (event, state) {
 rasterLayer.setVisible(state)
 }
});
answered Sep 20, 2015 at 19:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.