Çağdaş
Çağdaş

Reputation: 1023

Color change event handling in jpicker

I have several jpickers. For ex: I want to change body background color meanwhile changing color in jpicker. How to handle color change event in jpicker?

js:

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

html

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

Any idea?

Thanks.

Upvotes: 0

Views: 1268

Answers (1)

user1180769
user1180769

Reputation:

Something like this

$('#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
        }
);

Look there: http://www.digitalmagicpro.com/jPicker/

Upvotes: 1

Related Questions