-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.html
222 lines (188 loc) · 8.67 KB
/
index.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html>
<head>
<title>bootstrap-colorselector</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="lib/bootstrap-3.0.3/css/bootstrap.min.css" rel="stylesheet" />
<link href="lib/bootstrap-colorselector-0.2.0/css/bootstrap-colorselector.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/docs.css" />
<link rel="stylesheet" type="text/css" href="css/prettify.css" />
</head>
<body>
<a href="https://github.com/flaute/bootstrap-colorselector"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<div class="container">
<section id="colorselectors">
<div class="page-header">
<h1>
ColorSelector for Bootstrap <small>bootstrap-colorselector.js</small>
</h1>
</div>
<h2>Examples</h2>
<p></p>
<h3>First Example</h3>
<p>The simplest way to use the ColorSelector.</p>
<div class="bs-docs-example">
<select id="colorselector_1">
<option value="106" data-color="#A0522D">sienna</option>
<option value="47" data-color="#CD5C5C" selected="selected">indianred</option>
<option value="87" data-color="#FF4500">orangered</option>
<option value="17" data-color="#008B8B">darkcyan</option>
<option value="18" data-color="#B8860B">darkgoldenrod</option>
<option value="68" data-color="#32CD32">limegreen</option>
<option value="42" data-color="#FFD700">gold</option>
<option value="77" data-color="#48D1CC">mediumturquoise</option>
<option value="107" data-color="#87CEEB">skyblue</option>
<option value="46" data-color="#FF69B4">hotpink</option>
<option value="47" data-color="#CD5C5C">indianred</option>
<option value="64" data-color="#87CEFA">lightskyblue</option>
<option value="13" data-color="#6495ED">cornflowerblue</option>
<option value="15" data-color="#DC143C">crimson</option>
<option value="24" data-color="#FF8C00">darkorange</option>
<option value="78" data-color="#C71585">mediumvioletred</option>
<option value="123" data-color="#000000">black</option>
</select>
</div>
<pre class="prettyprint linenums">
<select id="colorselector">
<option value="106" data-color="#A0522D">sienna</option>
<option value="47" data-color="#CD5C5C" selected="selected">indianred</option>
<option value="87" data-color="#FF4500">orangered</option>
...
<option value="15" data-color="#DC143C">crimson</option>
<option value="24" data-color="#FF8C00">darkorange</option>
<option value="78" data-color="#C71585">mediumvioletred</option>
</select>
<script>
$('#colorselector').colorselector();
</script>
</pre>
<h3>Second Example</h3>
<p>Set a color by its hex-value or value and define a callback-function.</p>
<div class="bs-docs-example">
<select id="colorselector_2">
<option value="106" data-color="#A0522D">sienna</option>
<option value="47" data-color="#CD5C5C" selected="selected">indianred</option>
<option value="87" data-color="#FF4500">orangered</option>
<option value="17" data-color="#008B8B">darkcyan</option>
<option value="18" data-color="#B8860B">darkgoldenrod</option>
<option value="68" data-color="#32CD32">limegreen</option>
<option value="42" data-color="#FFD700">gold</option>
<option value="77" data-color="#48D1CC">mediumturquoise</option>
<option value="107" data-color="#87CEEB">skyblue</option>
<option value="46" data-color="#FF69B4">hotpink</option>
<option value="47" data-color="#CD5C5C">indianred</option>
<option value="64" data-color="#87CEFA">lightskyblue</option>
<option value="13" data-color="#6495ED">cornflowerblue</option>
<option value="15" data-color="#DC143C">crimson</option>
<option value="24" data-color="#FF8C00">darkorange</option>
<option value="78" data-color="#C71585">mediumvioletred</option>
<option value="123" data-color="#000000">black</option>
</select> <br />
<button class="btn" type="button" id="setColor">set by color (#008B8B)</button>
<button class="btn" type="button" id="setValue">set by value (18)</button>
<input type="text" id="colorValue" /> <input type="text" id="colorColor" /> <input type="text" id="colorTitle" />
</div>
<pre class="prettyprint linenums">
<select id="colorselector">
<option value="106" data-color="#A0522D">sienna</option>
<option value="47" data-color="#CD5C5C" selected="selected">indianred</option>
<option value="87" data-color="#FF4500">orangered</option>
...
<option value="15" data-color="#DC143C">crimson</option>
<option value="24" data-color="#FF8C00">darkorange</option>
<option value="78" data-color="#C71585">mediumvioletred</option>
</select>
<button class="btn" type="button" id="setColor">set by color (#008B8B)</button>
<button class="btn" type="button" id="setValue">set by value (18)</button>
<input type="text" id="colorValue" />
<input type="text" id="colorColor" />
<input type="text" id="colorTitle" />
<script>
$('#colorselector').colorselector({
callback: function (value, color, title) {
$("#colorValue").val(value);
$("#colorColor").val(color);
$("#colorTitle").val(title);
}
});
$("#setColor").click(function(e) {
$("#colorselector").colorselector("setColor", "#008B8B");
});
$("#setValue").click(function(e) {
$("#colorselector").colorselector("setValue", 18);
});
</script>
</pre>
<hr class="bs-docs-separator">
<h2>Usage</h2>
<p>Include all the libs needed to use bootstrap, jquery and of course bootstrap-colorselector.</p>
<pre class="prettyprint linenums">
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="bootstrap-colorselector.css" />
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="bootstrap-colorselector.js"></script>
</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>callback</td>
<td>function</td>
<td></td>
<td>callback(value, color, title);</td>
</tr>
</tbody>
</table>
<h3>Methods</h3>
<h4>$().colorselector(options)</h4>
<p>
Attaches a colorselector to a
<code><select></code>
element.
</p>
<pre class="prettyprint linenums">$('#element').colorselector();</pre>
<h4>.colorselector('setColor', 'color')</h4>
<p>Sets a color specified by its hex-value.</p>
<pre class="prettyprint linenums">$('#element').colorselector('setColor', '#FF0000');</pre>
<h4>.colorselector('setValue', value)</h4>
<p>Sets a color specified by its value.</p>
<pre class="prettyprint linenums">$('#element').colorselector('setId', 4);</pre>
</section>
</div>
<br />
<!-- scripts -->
<script src="lib/jquery-1.10.2/jquery-1.10.2.min.js"></script>
<script src="lib/bootstrap-3.0.3/js/bootstrap.min.js"></script>
<script src="lib/bootstrap-colorselector-0.2.0/js/bootstrap-colorselector.js"></script>
<script src="lib/google-code-prettify/prettify.js"></script>
<script>
$(function() {
window.prettyPrint && prettyPrint();
$('#colorselector_1').colorselector();
$('#colorselector_2').colorselector({
callback : function(value, color, title) {
$("#colorValue").val(value);
$("#colorColor").val(color);
$("#colorTitle").val(title);
}
});
$("#setColor").click(function(e) {
$("#colorselector_2").colorselector("setColor", "#008B8B");
})
$("#setValue").click(function(e) {
$("#colorselector_2").colorselector("setValue", 18);
})
});
</script>
</body>
</html>