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才会改变,这个问题找了好久没有找到答 ...
随机推荐
- Spring Boot 系列教程6-全局异常处理
@ControllerAdvice源码 package org.springframework.web.bind.annotation; import java.lang.annotation.Ann ...
- sql trim()函数去掉两头空格
1.sql trim()函数去掉两头空格 sql语法中没有直接去除两头空格的函数,但有ltrim()去除左空格rtrim()去除右空格. 合起来用就是sql的trim()函数,即select ltri ...
- 简易控制中心,angular的简单使用
<html> <head> <meta charset='utf-8'> <script src="js/angular.js">& ...
- HDU1879--继续畅通工程(最小生成树)
Problem Description 省政府"畅通工程"的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可).现得到城镇道路统计 ...
- Basically Speaking
Basically Speaking Time Limit: 2 Sec Memory Limit: 200 MB Submit: 19 Solved: 11 [Submit][Status][W ...
- 本地php 连接 MySQL
1. 在D:\xampp\htdocs下创建test.php <?php $dbhost = 'localhost:3306'; //mysql服务器主机地址 $dbuser = 'root'; ...
- Android Studio开发环境的配置
为了使开发人员与时俱进, 在这里给大家讲解一下Android Studio的安装步骤及设置. 使用的是Android的最新版本,0.4.2版本,Android Studio可以脱离Eclipse单独运 ...
- java OPENCV 连通域, Imgproc.findContours 例子,参数说明
http://stackoverflow.com/questions/29491669/real-time-paper-sheet-detection-using-opencv-in-android/ ...
- 草,又学了个新命令,nc传文件。
nc -l 5222 > aa nc 192.168.0.48 5222 < a http://www.linuxso.com/command/nc.html
- 使用traceview进行Android性能测试(转)
使用traceview进行Android性能测试(转) 使用traceview进行Android性能测试 原文链接:http://www.cnblogs.com/Android-and-androi ...