Bootstrap 切换 Class 状态

Bootstrap Switch Change Class to State

如果状态变为 true 或 false,如何动态更改某些 bootstrap switch css classes?事实上,如果可能的话,追加一个新的 class 也可以解决我的问题。有什么简单有用的方法吗?我篡改了文档,但一无所获。

onSwitchChange 事件对于这种情况已经足够了,但我需要一些帮助。

更新

我附上了一张图片,说明了我想要实现的目标。

我认为 CSS 是实现您想要实现的目标的正确方法, 您需要做的就是将您的开关放在父 div 中,然后写一些 CSS

.parent-div .boostrap-switch-on{
  //enter styles for the ON state
  }
.parent-div .boostrap-switch-off{
  //enter styles for the OFF state
  }