【问题标题】:Color change event handling in jpickerjpicker中的颜色更改事件处理
【发布时间】:2012-05-07 06:48:41
【问题描述】:

我有几个 jpicker。例如:我想更改正文背景颜色,同时更改 jpicker 中的颜色。 jpicker如何处理颜色变化事件?

js:

$('#colorSelector').jPicker(
                {
                    window:{expandable:true}
                });

html

<span id="colorSelector"></span>

有什么想法吗?

谢谢。

【问题讨论】:

  • 当您说“我想在 jpicker 中更改颜色的同时更改正文背景颜色”时,您的意思是当您在 jpicker 中更改颜色时,正文背景应该更改为该颜色?

标签: jquery html jpicker


【解决方案1】:

类似的东西

$('#Callbacks').jPicker(
        {},
        function(color, context)
        {
          var all = color.val('all');
          alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') + ' - alpha: ' + (all && all.a + '%' || 'none'));
          $('#Commit').css(
            {
              backgroundColor: all && '#' + all.hex || 'transparent'
            }); // prevent IE from throwing exception if hex is empty
        }
);

看那里:http://www.digitalmagicpro.com/jPicker/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-27
    • 2012-12-22
    • 2012-09-14
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 2016-03-16
    • 1970-01-01
    相关资源
    最近更新 更多