bootstrap switch功能
bootstrap switch是一个按钮开关,点击时获取其状态可通过以下代码:
<input id="email_switch_state" type="checkbox">
$('#email_switch_state').on({
'switchChange.bootstrapSwitch': function(event, state) {
if (state == true)
{
$('#text').html('OK');
}
else
{
$('#text').html('NO');
}
}
});
Additional Methods
| Name | Description |
|---|---|
| toggleState | Toggle the switch state |
| toggleAnimate | Toggle the animate option |
| toggleDisabled | Toggle the disabled state |
| toggleReadonly | Toggle the readonly state |
| toggleIndeterminate | Toggle the indeterminate state |
| toggleInverse | Toggle the inverse option |
| destroy | Destroy the instance of Bootstrap Switch |
Options
| Name | Attribute | Type | Description | Values | Default |
|---|---|---|---|---|---|
| state | checked | Boolean | The checkbox state | true, false | true |
| size | data-size | String | The checkbox size | null, 'mini', 'small', 'normal', 'large' | null |
| animate | data-animate | Boolean | Animate the switch | true, false | true |
| disabled | disabled | Boolean | Disable state | true, false | false |
| readonly | readonly | Boolean | Readonly state | true, false | false |
| indeterminate | data-indeterminate | Boolean | Indeterminate state | true, false | false |
| inverse | data-inverse | Boolean | Inverse switch direction | true, false | false |
| radioAllOff | data-radio-all-off | Boolean | Allow this radio button to be unchecked by the user | true, false | false |
| onColor | data-on-color | String | Color of the left side of the switch | 'primary', 'info', 'success', 'warning', 'danger', 'default' | 'primary' |
| offColor | data-off-color | String | Color of the right side of the switch | 'primary', 'info', 'success', 'warning', 'danger', 'default' | 'default' |
| onText | data-on-text | String | Text of the left side of the switch | String | 'ON' |
| offText | data-off-text | String | Text of the right side of the switch | String | 'OFF' |
| labelText | data-label-text | String | Text of the center handle of the switch | String | ' ' |
| handleWidth | data-handle-width | String | Number | Width of the left and right sides in pixels | 'auto' or Number | 'auto' |
| labelWidth | data-label-width | String | Number | Width of the center handle in pixels | 'auto' or Number | 'auto' |
| baseClass | data-base-class | String | Global class prefix | String | 'bootstrap-switch' |
| wrapperClass | data-wrapper-class | String | Array | Container element class(es) | String | Array | 'wrapper' |
| onInit | Function | Callback function to execute on initialization | Function |
|
|
| onSwitchChange | Function | Callback function to execute on switch state change | Function |
|
$.fn.bootstrapSwitch.defaults.size = 'large'; $.fn.bootstrapSwitch.defaults.onColor = 'success';$('#toggle-state-switch').bootstrapSwitch('state');
bootstrap switch功能的更多相关文章
- 前端插件之Bootstrap Switch 选择框开关控制
简介 Bootstrap Switch是一款轻量级插件,可以给选择框设置类似于开关的样式 它是依赖于Bootstrap的一款插件 下载 下载地址 在线引用 导入 因为它是依赖于Bootstrap的一款 ...
- bootstrap switch样式修改与多列等间距布局
先以一张图开启今天的随笔 今天实习遇到了switch按钮,小姐姐说用插件bootstrap switch来写,我第一次用这个插件,首先在引入方面就遇到了很多坑,先来总结一下bootstrap swit ...
- Python_Tips[1] -> 利用 Python 的字典实现 Switch 功能
利用 Python 的字典实现 Switch 功能 Python是没有switch语句的,当遇到需要实现switch语句的功能时,一般可以用if/else进行代替,但是还有一种更加简洁的实现方法,利用 ...
- python学习 05 函数switch功能
1.python没有switch功能,利用字典实现 如果用if else,可行但是效率不高
- android SIM Switch功能和配置
SIM Switch feature是Smart 3G switch feature在LTE版本号上发展演变而来的功能: MTK双卡双待单通版本号仅仅有一个3/4 G Protocol.所以同一时刻仅 ...
- 前端基础(十):Bootstrap Switch 选择框开关控制
简介 Bootstrap Switch是一款轻量级插件,可以给选择框设置类似于开关的样式 它是依赖于Bootstrap的一款插件 下载 下载地址 在线引用 导入 因为它是依赖于Bootstrap的一款 ...
- 浅谈Bootstrap自适应功能在Web开发中的应用
随着移动端市场的强势崛起,web的开发也变得愈发复杂,对于个体开发者来说,自己开发的网站,在电脑.手机.Pad等上面都要有正常的显示以及良好的用户体验.如果每次都要自己去调整网页去匹配各个不同的客户端 ...
- 使用jQuery获取Bootstrap Switch的值
$('#switcher').bootstrapSwitch('state'); // true || false $('#switcher').bootstrapSwitch('toggleStat ...
- bootstrap Switch 的一个坑点
在bootstrap的modal点开的时候改变bootstrapSwitch的状态的时候,会出现第一次打开modal,switch没有变化,第二次以后打开modal才会改变,这个问题找了好久没有找到答 ...
随机推荐
- Factory and AbstractFactory ——抽象与具体的分离
Factory and AbstractFactory——抽象与具体的分离 面向对象标准关注于抽取一系列事物的共同行为,组建一个基类.行为再划分成两类: 1:现在及以后不太可能会变化的行为. 2:以后 ...
- cmd下载文件
进入cmd 输入ftp 192.168.1.200 然后按照提示输入用户名和密码 cd 进入要下载的目录 dir 看操作权限 lcd查看本地要装下载文件的目录 prompt关闭交互模式 mget da ...
- python 基本的序列和映射规则
>>> def checkIndex(key):... if not isinstance(key,(int,long)):raise TypeError... if ...
- Camera Path插件的使用
rpg游戏类型的游戏,猪脚走过一个个场景,一个个死角.拐弯处,摄像机镜头也能很好的跟踪对焦,很多朋友都会想,这摄像机如何智能跟踪并且对焦呢? 之前 itween也有demo,但它做法是 两条线,一条摄 ...
- HDU 5323 DFS
DFS Time Limit : 5000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submissio ...
- UVALive 2403 77377解题报告(深搜)
题意:给你一些固定的字符串,在给出数字,根据键盘的对应关系,输出所有的满足条件的字符串,输出顺序无所谓. 思路:因为题目说了,输出比较小,说明测试数据并不强,所以可以暴力回溯求出答案,将所有的给出的字 ...
- js date相关学习!
var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); //获取完整的年份(4位,1970-???? ...
- arrayList里的快速失败
快速失败是指某个线程在迭代集合类的时候,不允许其他线程修改该集合类的内容,这样迭代器迭代出来的结果就会不准确. 比如用iterator迭代collection的时候,iterator就是另外起的一个线 ...
- SVN分支的创建,合并,与销毁和相关操作
test是分支和主干所在的文件夹,SVNTest是主干,所有的分支都放在branch里面,192.168.1.101是服务器的地址 创建分支: 把服务器中的主干复制出来到自己的分支上: svn cop ...
- Django: 之Apache、Nginx部署以及发送邮件
在这里讲述部署的方法和常见的问题,并给出了在BAE,JAE,SAE等上面部署的实例. Django + nginx + Gunicorn/uwsgi部署方式,参见另一篇:Django部署(nginx) ...