source: other-projects/nz-flag-design/trunk/main-form/bgrins-spectrum/example/testcase.html@ 29741

Last change on this file since 29741 was 29741, checked in by davidb, 9 years ago

Support JS library for colour picker

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1
2<!doctype html>
3<html>
4<head>
5 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
6 <title>Spectrum - The No Hassle jQuery Colorpicker</title>
7
8 <meta name="description" content="Spectrum is a JavaScript colorpicker plugin using the jQuery framework. It is highly customizable, but can also be used as a simple input type=color polyfill">
9 <meta name="author" content="Brian Grinstead and Spectrum contributors">
10
11 <link rel="stylesheet" type="text/css" href="../spectrum.css">
12 <link rel="stylesheet" type="text/css" href="../docs/bootstrap.css">
13 <link rel="stylesheet" type="text/css" href="../docs/docs.css">
14 <script type="text/javascript" src="../docs/jquery-1.9.1.js"></script>
15 <script type="text/javascript" src="../spectrum.js"></script>
16</head>
17<body>
18<div id='header'>
19 <h1><a href='http://bgrins.github.com/spectrum'>Spectrum</a></h1> <h2><em>The No Hassle jQuery Colorpicker</em></h2>
20 <div id='links'>
21 View the <a href='http://github.com/bgrins/spectrum'>Source code</a>.
22 Spectrum is a project by <a href='http://twitter.com/bgrins'>@bgrins</a>.
23 </div>
24 <br style='clear:both;' />
25</div>
26
27<div class="container">
28 <h2>Basic Test Case</h2>
29 <p>Also available as a <a href="http://jsfiddle.net/bgrins/ctkY3/">jsfiddle</a></p>
30
31<button id="update">Update palette</button>
32<h2>Full Example</h2>
33<input type='text' id="full"/>
34
35</div>
36
37<script type="text/javascript">
38
39$("#update").click (function() {
40 console.log($("#full").spectrum("option", "palette"));
41 $("#full").spectrum("option", "palette", [
42 ["red", "green", "blue"]
43 ]);
44});
45
46$("#full").spectrum({
47 color: "#ECC",
48 flat: true,
49 showInput: true,
50 className: "full-spectrum",
51 showInitial: true,
52 showPalette: true,
53 showSelectionPalette: true,
54 maxPaletteSize: 10,
55 preferredFormat: "hex",
56 localStorageKey: "spectrum.demo",
57 move: function (color) {
58
59 },
60 show: function () {
61
62 },
63 beforeShow: function () {
64
65 },
66 hide: function () {
67
68 },
69 change: function() {
70
71 },
72 palette: [
73 ["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)",
74 "rgb(204, 204, 204)", "rgb(217, 217, 217)","rgb(255, 255, 255)"],
75 ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
76 "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"],
77 ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
78 "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)",
79 "rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)",
80 "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)",
81 "rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)",
82 "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
83 "rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
84 "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
85 "rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)",
86 "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
87 ]
88});
89
90</script>
91</body>
92</html>
93
Note: See TracBrowser for help on using the repository browser.