|
Color Picker Widget
Color picker helps to select a RGB color. Color picker widget comes in Max and Mini types
Basic Usage $.domLoaded(function() {
$.get("#call").widget("colorpicker", CONFIG_JSON );
}
Configuring Options
It contains array of JSON objects. The properties are mentioned below.
Methods
Color Picker Widget Examples Example 1
JS
HTML
$.domLoaded( function() {
$.get("#pick1").widget("colorpicker", {
type : "max",
fulldisplay : true,
def : "#0000ff"
});
$.get("#pick2").widget("colorpicker", {
type : "mini",
fulldisplay : true,
def : "#0000ff"
});
});
Result
Example 2
JS
HTML
$.domLoaded( function() {
$.get("#pick1").widget("colorpicker", {
type : "mini",
fulldisplay : false,
def : "#0000ff"
});
$.get("#pick2").widget("colorpicker", {
type : "max",
def : "#0000ff",
input : true
});
});
Result
Example 3
JS
HTML
$.domLoaded( function() {
$.get("#pick1").widget("colorpicker", {
type : "max",
fulldisplay : true,
def : "#0000ff",
onselect : function(col) {
alert("Selected Color is " + col);
},
onchange : function(col) {
$.get("body > div").style("background-color", col);
}
});
$.get("#dial").widget("dialog" ,{
head : {
title : "Color Picker Changes background color of Dialog"
},
dim : { wid : 500, ht : 300},
close : true,
draggable : true
});
});
Result
Example 4
JS
HTML
$.domLoaded( function() {
var pick1;
pick1 = $.get("#pick1").widget("colorpicker", {
type : "max",
fulldisplay : true,
hide : true,
def : "#0000ff"
});
$.get("#sel1").on("click", function() {
pick1.show();
});
$.get("#sel2").on("click", function() {
pick1.hide();
});
$.get("#sel3").on("click", function() {
alert(pick1.getColor());
});
});
Result
| |||||||||||||||||||||||||||||||||||||||||||||||
