views:

22

answers:

2

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...

+2  A: 

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.

Nick Craver
Hey Nick, thanks for the answer to my first question! Regarding the second one: I see that in the "jPicker Expandable Example" (http://www.digitalmagicpro.com/jPicker/#Expandable) the color picker window is drag-able. How it is done there ??
Misha Moroshko
@Misha - Oh you're right, seems it's built-in, are you using the latest version? I don't remember it, so seems it was added in a recent version with any non-inline picker by default.
Nick Craver
I'm using version 1.1.5 (the latest for now). In my case, I don't set `window.expandable` to `true`. Do you think it is still possible to make the window drag-able ? Thanks for your help!
Misha Moroshko
+1  A: 

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'}
});
WoLpH