Foren

Pre-set color to AUI colorpicker

Mk Sin, geändert vor 11 Jahren.

Pre-set color to AUI colorpicker

Junior Member Beiträge: 74 Beitrittsdatum: 25.05.12 Neueste Beiträge
http://www.liferay.com/community/liferay-projects/alloy-ui/demo?title=community-liferay-projects-alloy-ui-demos-color-picker
Following that link, i know how to use colorpicker, and it work fine, but...
I dont know how to pre-set color in the picker( when click on the picker, colorpicker popup open with no color preset, the next times it will open with lastest color you picked)
Anybody can help me plz emoticon
thumbnail
Yaroslav Rudyy, geändert vor 11 Jahren.

RE: Pre-set color to AUI colorpicker

New Member Beiträge: 2 Beitrittsdatum: 02.03.11 Neueste Beiträge
Mk Sin:
http://www.liferay.com/community/liferay-projects/alloy-ui/demo?title=community-liferay-projects-alloy-ui-demos-color-picker
Following that link, i know how to use colorpicker, and it work fine, but...
I dont know how to pre-set color in the picker( when click on the picker, colorpicker popup open with no color preset, the next times it will open with lastest color you picked)
Anybody can help me plz emoticon



<aui:script use="aui-color-picker">
AUI().ready('aui-color-picker-base', function(A) {
var colorNode = A.one('#color');
window.colorPicker = new A.ColorPicker({
hex: colorNode.text(),
after: {
colorChange: function(val) {
var hex = '#' + this.get('hex');
colorNode.setContent('color: ' + hex);
colorNode.setStyle('backgroundColor', hex);
}
}
}).render('#demo');
});
</aui:script>