Reputation: 171321
I'm using jPicker, and I would like to change the active color in my code (I create one instance of jPicker at the beginning, with some default active color).
Is that possible ?
Also, is that possible to make the jPicker window drag-able ? Sometimes, I would like to move the window to other location...
Upvotes: 1
Views: 1994
Reputation: 630389
Yes you can set the color after it's initialized like this:
$.jPicker.List[0].color.active.val('rgb', { r: 123, g: 123, b: 123 });
//or hex style:
$.jPicker.List[0].color.active.val('ahex', 'FFFFFFFF'); //last 2 are alpha
Where each value is the 0-255 of the color for red, green, and blue. The dragging there's no built-in support for, but you may be able to use a jQuery UI .draggable()
on the panel...not sure what possible conflicts the picker's bindings will have with that.
Upvotes: 6
Reputation: 80031
As you can see on the page you linked to, you can change the color by adding a color
argument.
$('#colorpicker').jPicker({
color: {active: '#FFCC00'}
});
Upvotes: 2