kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
GNU General Public License v2.0
132 stars 88 forks source link

Allow Target DOM Element to be passed (Enhancement) #41

Closed maddisondesigns closed 4 years ago

maddisondesigns commented 4 years ago

The underlying Iris script allows you to pass a Target element in its options. This allows you to display the color picker somewhere other than directly after the element you are calling it on. Passing a Target option to this wp-color-picker-alpha control, doesn't seem to work. It would be great if you could get this working so that we can make use of this option.

Thanks.

kallookoo commented 4 years ago

This is good new option for the new version, but by default this script create the color picker if exists the class and the data-alpha and the original color picker does the same, if I'm not mistaken.

maddisondesigns commented 4 years ago

I don't think the default WP Color Picker script (i.e. the one built into WP Core) allows you to pass a Target element. I'm positive I've tried and couldn't get it to work. The underlying Iris script though, does allow you to specify a Target element, and that works ok.

Here's a quick CodePen showing the Iris Script in action.

kallookoo commented 4 years ago

After examining the code, this feature does not fall within the wpColorPicker operation and I will not implement it. Although the Iris allows you to specify the target, the wpColorPicker is the one that creates the design of the color picker for WordPress and it makes no sense to modify the wpColorPicker, if you want to create in another target I see more logical to use the Iris directly and create your own design.