bootstrap4-toggle
bootstrap4-toggle copied to clipboard
Would be great to have CSS only instructions
I use Elm and letter jquery play around with the dom can lead to problems. I like the styling but could not figure out how much of the javascript was doing essential thigns above and beyond adding/removing styles
Hi @simonh1000
This library is actually a jQuery plugin, so it's dependent on jQuery all the way up.
There is another version without jQuery that uses modern JavaScript instead that you may consider: bootstrap-switch-button
Lastly, a lighter version that consists entirely of CSS (and Bootstrap components) seems plausible, it would just require users to construct the switch-button themselves (it's a containing div with some buttons) and then manage events using inline onChange
calls.
yes it was this last point that I meant - as I use Elm, I'm used to reimplementing stuff in our strange but lovable language, but your CSS is valuable in its own right. However, when I looked at the javascript I could see that there is rather more happening that just adding or removing a couple of classes and handling a couple of events