javascript - Spectrum Color picker not setting color and alpha value in flat mode -


i'm using spectrum color picker jquery plugin, i'm trying set color , alpha value plugin default when color picker opens , not selects color , alpha in roller, default selects left corner color.

$container.find('#color-palette').spectrum({     color: 'rgba(136, 171, 145, 0.5)',     flat: true,     showinput: false,     showalpha: true,     showselectionpalette: false,     showbuttons: false,     showinput: true }); 

in th above example have passed color value alpha value, doesn't set passed value in color picker.

if have suggestion please reply this.

thanks, gopi

so had exact same issue. found calculation color picker being done before color picker visible on screen, meaning picker's height , width not set causing default top left corner. if color picker hidden, being animated, or not visible when it's being initialized or when color being set, bug happen.

the solution tell color picker reflow after visible. command:

$container.spectrum("reflow"); 

here's documentation it.

where put above line depend on container being initialized , state in when do, try put somewhere you're sure color picker visible , has it's height , width calculated.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -