-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathexample.html
104 lines (90 loc) · 3.38 KB
/
example.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<title>simpleColorPicker jQuery plugin</title>
<link type="text/css" href="jquery.simple-color-picker.css" rel="stylesheet" />
<style type="text/css">
body { font-family: sans-serif; font-size: 12px; margin: 0px; }
h1 { font-size: 16px; margin: 0px; padding: 5px 5px; }
h2 { font-size: 14px; margin: 0px; padding: 5px 5px; }
h3 { font-size: 12px; margin: 0px; padding: 2px 0px; }
ul { list-style-type: none; padding: 0px; margin: 0px 10px; }
p { margin: 10px 0px; padding: 0px 5px; }
label { display: block; }
input#color { width: 150px; }
pre { font-family: monospace; display: block; margin: 5px; }
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="jquery.simple-color-picker.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input#color').simpleColorPicker();
$('input#color2').simpleColorPicker({ colorsPerLine: 16 });
var colors = ['#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#f3f3f3', '#ffffff'];
$('input#color3').simpleColorPicker({ colors: colors });
$('input#color4').simpleColorPicker({ showEffect: 'fade', hideEffect: 'slide' });
$('button#color5').simpleColorPicker({ onChangeColor: function(color) { $('label#color-result').text(color); } });
});
</script>
</head>
<body>
<h1>simpleColorPicker jQuery plugin</h1>
<p>A simple color picker jQuery plugin that appears as the user focuses the input.</p>
<p>Just attach the simpleColorPicker to an input text and when it gains focus the color palette appears aligned to its bottom right corner.</p>
<p>Check out the latest version at <a href="http://github.com/rachel-carvalho/simple-color-picker">http://github.com/rachel-carvalho/simple-color-picker</a>.</p>
<h2>Live samples</h2>
<ul>
<li>
<h3>Default options</h3>
<label for="color">Choose a color:</label>
<input type="text" id="color" name="color" />
<pre>
$(document).ready(function() {
$('input#color').simpleColorPicker();
});
</pre>
</li>
<li>
<h3>More colors per line</h3>
<label for="color2">Choose a color:</label>
<input type="text" id="color2" name="color2" />
<pre>
$(document).ready(function() {
$('input#color2').simpleColorPicker({ colorsPerLine: 16 });
});
</pre>
</li>
<li>
<h3>Different colors</h3>
<label for="color3">Choose a color:</label>
<input type="text" id="color3" name="color3" />
<pre>
$(document).ready(function() {
var colors = ['#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#f3f3f3', '#ffffff'];
$('input#color3').simpleColorPicker({ colors: colors });
});
</pre>
</li>
<li>
<h3>Effects</h3>
<label for="color4">Choose a color:</label>
<input type="text" id="color4" name="color4" />
<pre>
$(document).ready(function() {
$('input#color4').simpleColorPicker({ showEffect: 'fade', hideEffect: 'slide' });
});
</pre>
</li>
<li>
<h3>Non-input elements</h3>
<label id="color-result">No color chosen yet</label>
<button id="color5">Choose a color</button>
<pre>
$(document).ready(function() {
$('button#color5').simpleColorPicker({ onChangeColor: function(color) { $('label#color-result').text(color); } });
});
</pre>
</li>
</ul>
</body>
</html>