Nice. As an extension, you can actually get a hidden or stylized checkbox to maintain the toggle state and get rid of the JS entirely... A pure css only toggle.
Sorry for the late reply, was inactive for a while. Basically, the idea is to maintain the toggle on/off state with a hidden checkbox's built-in checked state, and use sibling selectors to style the UI.
Something in the lines of:
.chkbox + blah {
// styles for off UI
}
.chkbox:checked + blah {
// styles for on UI
}
Nice. As an extension, you can actually get a hidden or stylized checkbox to maintain the toggle state and get rid of the JS entirely... A pure css only toggle.
Would you mind explaining a bit more how you would go about doing that?
Sorry for the late reply, was inactive for a while. Basically, the idea is to maintain the toggle on/off state with a hidden checkbox's built-in checked state, and use sibling selectors to style the UI.
Something in the lines of:
.chkbox + blah {
// styles for off UI
}
.chkbox:checked + blah {
// styles for on UI
}
Oh, that's a cool trick! Cheers!