【问题标题】:Switchery custom external css coloringSwitchery自定义外部CSS着色
【发布时间】:2016-02-02 11:06:31
【问题描述】:

我有:

var check=new Switchery(elem, {
    size: 'small',
    color: '#c00',
    secondaryColor: '#b7b7b7',
    jackColor: '#fff',
    jackSecondaryColor: '#f3f3f3',
    className: 'switchery'
});

我希望这两种状态的所有着色参数都必须在外部 css 文件中。正如所料:

.switchery {
    color: #c00;
    secondaryColor: #b7b7b7;
    jackColor: #fff;
    jackSecondaryColor: #f3f3f3;
}

没用。有什么想法吗?

【问题讨论】:

    标签: css colors external switchery


    【解决方案1】:

    我用 Jquery 解决了这个问题, 复选框旁边的所有switchery都已更改。

    通过改变其背景颜色,并将switchery的颜色设置为无

    >>> My fiddle Demo <<<<

    elems.forEach(function(html) {
      var check=new Switchery(html, {
        size: 'small',
        color: '',    // to make it transparent, must set this 
        className: 'switchery switcherya'   // i am using custom class, but switchery is okay
        });
    });
    
    $('input[type="checkbox"]').on('click change', function(e) {
        if (this.checked) { //Checkbox has been checked
         $(this).next("span").css( "background-color", "" );   // Reset
      }
    });
    

    更多文档:

    https://api.jquery.com/siblings/

    【讨论】:

      猜你喜欢
      • 2012-09-28
      • 2012-10-12
      • 1970-01-01
      • 1970-01-01
      • 2011-10-09
      • 2012-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多