Available in the Full Version
Radial Menu - Color Items
This sample demonstrates how to define and use color items and color wells to allow color drilldown selection.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
This sample is designed for a larger screen size.
On mobile, try rotating your screen, view full size, or email to another device.
This sample demonstrates how to define and use color items and color wells to allow color drilldown selection.
Code View
Copy to Clipboard
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.dv.js"></script> </head> <body> <div> <!-- Target element for the igHtmlEditor --> <div id="htmlEditor"></div> <div style="position:absolute; left:300px; top:90px; z-index:1; visibility:hidden"> <!-- Target element for the igRadialMenu --> <div id="radialMenu"></div> </div> </div> <script> $(function () { function rgbaToRgb(rgbaColor) { // remove the "a" from "rgba" var result = rgbaColor.replace("rgba(", "rgb("); // remove the alpha channel result = result.replace(",1)", ")"); return result; } function setForeColor(color) { $("#htmlEditor").igHtmlEditor("executeAction", "forecolor", color); } function setBackColor(color) { $("#htmlEditor").igHtmlEditor("executeAction", "backcolor", color); } // create the html editor $("#htmlEditor").igHtmlEditor({ width: "98%", height: "450px" }); $("#htmlEditor").igHtmlEditor("setContent", "The Radial Menu control is essentially a context menu presenting its items in a circular arrangement around a center button. The circular arrangement of the items speeds up items selection, because each item is equally positioned in relation to the center. The Radial Menu supports different item types for choosing numerical values, color values or performs actions. Sub-Items are also supported.<br/>By default the only visible part of the Radial Menu is the center button. When the user click on the center button, the Radial Menu opens and shows the root level menu items. Clicking on the center button when the root level items are shown closes the Radial Menu. To navigate Sub-Items the user should click the arrows in the outer ring and the corresponding sub-items group will be displayed. Clicking on the center button when a sub-items group is shown will display the items on the previous level.", "html"); // create the radial menu $('#radialMenu').igRadialMenu({ width: "300px", height: "300px", items: [ { // defining color item 1 type: "coloritem", header: "Foreground", iconUri: "/images/samples/radial-menu/FColor.png", color: "rgba(0,0,0,1)", colorChanged: function (evt) { var colValue = evt.newValue; colValue = rgbaToRgb(colValue); setForeColor(colValue); }, // defining color wells as sub-items for color item 1 items: [ { type: "colorwell", color: "#FFFF00" }, { type: "colorwell", color: "#C00000" }, { type: "colorwell", color: "#008000" }, { type: "colorwell", color: "#002060" }, { type: "colorwell", color: "#000000" }, { type: "colorwell", color: "#FFFFFF" }, ] }, { // defining color item 2 type: "coloritem", header: "Background", iconUri: "/images/samples/radial-menu/BColor.png", color: "rgba(255,255,255,1)", colorChanged: function (evt) { var colValue = evt.newValue; colValue = rgbaToRgb(colValue); setBackColor(colValue); }, // defining color wells as sub-items for color item 2 items: [ { type: "colorwell", color: "#FFFF00" }, { type: "colorwell", color: "#C00000" }, { type: "colorwell", color: "#008000" }, { type: "colorwell", color: "#002060" }, { type: "colorwell", color: "#000000" }, { type: "colorwell", color: "#FFFFFF" }, ] } ] }); }); </script> </body> </html>