• iCheck插件的基础用法


    1、初始化:
    选中元素进行初始化;
    $('input').iCheck({
      checkboxClass: 'icheckbox_flat-blue', //选择框的风格。
      radioClass: 'icheckbox_flat-blue',
    });
    具体颜色:
    Black — minimal.css //黑色
    Red — red.css //红色
    Green — green.css //绿色
    Blue — blue.css //蓝色
    Aero — aero.css //win7中的那种玻璃效果
    Grey — grey.css //银灰色
    Orange — orange.css //橙色
    Yellow — yellow.css //黄色
    Pink — pink.css //粉红色
    Purple — purple.css //紫色

    2、触发事件详解:
    选中事件
    $('input').on('ifChecked', function(event){ })
    取消选中事件
    $('input').on('ifUnchecked', function(event){ })
    改变事件
    $('input').on('ifChanged', function(event){ })
    用户点击了自定义的输入框或与其相关联的label
    $('input').on('ifClicked', function(event){ })
    输入框状态变为 disabled
    $('input').on('ifDisabled', function(event){ })
    disabled 状态被移除
    $('input').on('ifEnabled', function(event){ })
    输入框被应用了iCheck样式
    $('input').on('ifCreated', function(event){ })
    iCheck样式被移除
    $('input').on('ifDestroyed', function(event){ })

    3、主动触发设置
    $('input').iCheck('check'); //将输入框的状态设置为checked
    $('input').iCheck('uncheck'); //移除 checked 状态
    $('input').iCheck('toggle'); //toggle checked state
    $('input').iCheck('disable'); //将输入框的状态设置为 disabled
    $('input').iCheck('enable'); //移除 disabled 状态
    $('input').iCheck('update'); //apply input changes, which were done outside the plugin
    $('input').iCheck('destroy'); //移除iCheck样式

    4、获取操作
    1)获取选中的input:
    $('input').on('ifChecked', function(event){
    $(event.target)
    });
    2)event对象:
    $(".icheckbox_flat-blue.checked").find("input")

    3)获取当前选中的input的val值:
    $('input').on('ifChecked', function(event){
    $(event.target).val()
    });

  • 相关阅读:
    通过命令行指定 Java 程序运行时使用的字符集
    Ubuntu Linux 开启 root 用户及其它登录问题的解决
    SLF4J 的几种实际应用模式 SLF4J+Log4J 与 SLF4J+LogBack
    Java 获取当前时间的年月日方法
    Eclipse 全屏插件
    Linux 下的纯 C 日志函数库: zlog
    如何使用 Log4j
    DAO 设计模式
    为什么要用 /dev/null 2>&1 这样的写法
    NSDate和NSString之间的转换
  • 原文地址:https://www.cnblogs.com/qxz17760485467/p/12936447.html
Copyright © 2020-2023  润新知