Bootstrap Switch是一款轻量级插件,能够给选择框设置相似于开关的样式javascript
它是依赖于Bootstrap的一款插件css
下载地址html
在线引用java
由于它是依赖于Bootstrap的一款插件,因此,在引入以前要先引入Bootstrap样式python
<link rel="stylesheet" type="text/css" href="/static/plugin/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/plugin/switch/bootstrap-switch.min.css"> <script src="/static/plugin/bootstrap/js/bootstrap.min.js"></script> <script src="/static/plugin/switch/bootstrap-switch.min.js"></script>
# 定义一个选择框 <input type="checkbox" name="test"> # 给选择框应用样式 <script type="text/javascript"> $("[name='test']").bootstrapSwitch(); </script>
除了默认的样式,还能够经过给input框设置属性的方式给它自定义一些样式web
data-size="..."bootstrap
Mini 迷你插件
Small 小号orm
Normal 正常cdn
Large 大号
data-on-color="..."
data-off-color="..."
data-on-text="..."(str类型)
data-off-text="..."
data-handle-width=".."(int类型)
data-label-width="..."(int类型)
readonly=""
disabled=""
更多