Repository navigation
Expand file tree
/
Copy pathapi.js
More file actions
51 lines (43 loc) · 1.42 KB
/
Copy pathapi.js
File metadata and controls
51 lines (43 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
this.default = function () {
//Initialize ColorPicker
var colorPickerObj = new ej.inputs.ColorPicker({ change: change }, '#color-picker');
var hexInput = document.getElementById('hex-input');
// Triggers while changing colors.
function change(args) {
hexInput.value = args.currentValue.hex;
}
var ddlObj = new ej.dropdowns.DropDownList({
value: 'Picker',
popupHeight: '200px',
change: function () {
colorPickerObj.mode = ddlObj.value;
}
},
'#ddl');
new ej.buttons.CheckBox({
checked: true,
change: function (args) {
colorPickerObj.showButtons = args.checked;
}
},
'#show-btn');
new ej.buttons.CheckBox({
checked: false,
change: function (args) {
colorPickerObj.disabled = args.checked;
}
},
'#disabled');
new ej.buttons.CheckBox({
checked: true,
change: function (args) {
colorPickerObj.modeSwitcher = args.checked;
}
},
'#mode-switch');
hexInput.oninput = function () {
var val = hexInput.value;
// Sets to color picker default color value if user types the invalid hex code.
colorPickerObj.value = val && val.length > 2 ? (val[0] !== '#' ? '#' + val : val) : '#008000';
};
};