Jquery MiniColor不使用css值透明

Jquery MiniColor不使用css值透明,jquery,forms,colors,Jquery,Forms,Colors,我有一个问题,否则优秀的插件迷你色。当我想使用css值“transparent”时,它会以两种不同的方式对两个对象进行看似相同的处理。它在第一种情况下运行良好,而在第二种情况下则不行。有一个原因,我不能使用rgba的方式使用透明度。我知道MiniColor中的colorpicker将无法显示透明度,我只想停止将表单字段数据的值“transparent”转换为十六进制 首先,我有一个表单字段data_0,我使用minicolors初始化它,它使用输入值='transparent'设置为transp

我有一个问题,否则优秀的插件迷你色。当我想使用css值“transparent”时,它会以两种不同的方式对两个对象进行看似相同的处理。它在第一种情况下运行良好,而在第二种情况下则不行。有一个原因,我不能使用rgba的方式使用透明度。我知道MiniColor中的colorpicker将无法显示透明度,我只想停止将表单字段数据的值“transparent”转换为十六进制

首先,我有一个表单字段data_0,我使用minicolors初始化它,它使用输入值='transparent'设置为transparent

$('#data_0').minicolors({
    control: 'hue',
    defaultValue: $('#data_0').val(),
    hide: null,
    hideSpeed: 100,
    inline: false,
    letterCase: 'uppercase',
    opacity: false,
    position: 'default',
    show: null,
    showSpeed: 100,
    swatchPosition: 'left',
    textfield: true,
    theme: 'default',
    changeDelay: '100',
    change: function(hex) {
        //console.log(hex + ' - ' + opacity);
        $('#slide_bg').css('backgroundColor', hex);
        $('#slide_bg').css("background-color", hex);    
    }
});
然后,我在代码的后面有一个data_11,同样,设置为transparent,debug显示,在我用minicolors初始化它之前,它的值为“transparent”

我这样初始化它:

$('#data_11').minicolors({
    control: 'hue',
    defaultValue: null,//getDefaultMinicolor( '{{ data11 }}' ),
    hide: null,
    hideSpeed: 100,
    inline: false,
    letterCase: 'uppercase',
    opacity: false,
    position: 'default',
    show: null,
    showSpeed: 100,
    swatchPosition: 'left',
    textfield: true,
    theme: 'default',
    changeDelay: '100',
    change: function(hex) {
        //console.log(hex + ' - ' + opacity);
        $('#preview_title').css('backgroundColor', hex);
        $('#preview_title').css("background-color", hex);    
    }
});
现在调试显示,在我用minicolors初始化数据_11之后,它的值不再是“透明”的,而是“AAAAEE”,我假设它在某种程度上是十六进制,相当于字符串“透明”

所以我一点也不明白,他们怎么表现得不一样


默认值对任何一个都没有影响。

好的,下面是我解决问题的方法。但我还是不喜欢用这种方式破解我自己的应用程序。。。如果错误在我的代码中,我会很乐意找出

$('#data_11').minicolors({
    control: 'hue',
    defaultValue: 'nada',//getDefaultMinicolor( '{{ data11 }}' ),
    hide: null,
    hideSpeed: 100,
    inline: false,
    letterCase: 'uppercase',
    opacity: false,
    position: 'default',
    show: null,
    showSpeed: 100,
    swatchPosition: 'left',
    textfield: true,
    theme: 'default',
    changeDelay: '100',
    change: function(hex) {
        //console.log(hex + ' - ' + opacity);
        $('#preview_title').css('backgroundColor', hex);
        $('#preview_title').css("background-color", hex);    
    }
});
{% if data11 == 'transparent' %}
{# Due to some bug we need to hack the initialization of this colorpicker... strangely we don't need to with the first bg-color-picker (data0) #}
$('#data_11').val('transparent');
{% endif %}