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才会改变,这个问题找了好久没有找到答 ...
随机推荐
- HDU 1010 Temper of the bone(深搜+剪枝)
Tempter of the Bone Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) ...
- Linux学习 -- Shell基础 -- Bash基本功能
历史命令 history -c clear -w 写入 ~/.bash_history 默认保存1000条, 可在/etc/profile中修改 调用 Tab补全 命令.目录.文件 命令别名 ...
- CenOS下LAMP搭建过程
CentOS虚拟机中安装LAMP: Linux+Apache+MySQL+PHP 安装前先关闭防火墙和Selinux 把所有安装包解压到/lamp下(根目录下的lamp目录) 安装gcc, gcc-c ...
- codeforces 558/C Amr and Chemistry(数论+位运算)
题目链接:http://codeforces.com/problemset/problem/558/C 题意:把n个数变成相同所需要走的最小的步数易得到结论,两个奇数不同,一直×2不可能有重叠枚举每个 ...
- 困扰你的private static final long serialVersionUID
很多时候一个新手在写代码的时候,往往你的IDE就会告诉你一个警告 然后你点击处理这个警告之后,它就会默认给你的类生成一个 private static final long serialVersion ...
- Servlet程序开发--Servlet简介
使用java语言开发的服务器端程序,可以生成动态web页,运行在服务器端,由服务器调用执行,是一种按照servlet标准开发的类. 先有servlet,后有jsp,jsp骨子里依然是servlet. ...
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
在android4.0源码里面编译出来apk后,用adb install (或adb install -r 重装)安装时,报错[INSTALL_FAILED_DEXOPT]. xu@xu-PC:~$ ...
- mahout 查看kmeans结果的命令
$mahout seqdumper -i output/clusters-1/part-r-00000 直接在控制台上显示,要写入文件可以在后面加上-o <输出路径> mahout中的k ...
- Go语言实现列出排列组合
今天,隔壁坐的小朋友给我一串数字: 1 6 21 55 让我观察规律,然后帮他推导公式. 尼玛,当我是神呢?!! 想了半天没看出个原委, 于是看了他那边具体需要才发现他那边是对N个数字进行5个数字的组 ...
- 设计模式笔记之三:Android DataBinding库(MVVM设计模式)
本博客转自郭霖公众号:http://mp.weixin.qq.com/s?__biz=MzA5MzI3NjE2MA==&mid=2650236908&idx=1&sn=9e53 ...