-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html
233 lines (228 loc) · 7.89 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
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Colorpickerplus for Twitter Bootstrap</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="dist/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<link href="dist/css/bootstrap-colorpicker-plus.css" rel="stylesheet">
<style type="text/css">
.color-fill-icon{display:inline-block;width:16px;height:16px;border:1px solid #000;background-color:#fff;margin: 2px;}
.dropdown-color-fill-icon{position:relative;float:left;margin-left:0;margin-right: 0}
.well .markup{
background: #fff;
color: #777;
position: relative;
padding: 45px 15px 15px;
margin: 15px 0 0 0;
background-color: #fff;
border-radius: 0 0 4px 4px;
box-shadow: none;
}
.well .markup::after{
content: "Example";
position: absolute;
top: 15px;
left: 15px;
font-size: 12px;
font-weight: bold;
color: #bbb;
text-transform: uppercase;
letter-spacing: 1px;
}
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="page-header">
<h1><i class="glyphicon glyphicon-tint"></i> Bootstrap Colorpicker Plus <small>for Twitter Bootstrap</small></h1>
</div>
<div class="row">
<article class="col-md-12">
<p>
A Twitter Bootstrap component, more user fiendly colorpicker which integrated the <a href="https://github.com/mjolnic/bootstrap-colorpicker" target="_blank">Bootstrap Colorpicker</a>
<br>
<br> It basically adds a color picker to a field or any other element, alse can be embed to the page or dropdown menu.
</p>
<ul>
<li>common color panel</li>
<li>custom your favor color</li>
<li>the bootstrap-colorpicker integrated</li>
</ul>
<hr>
<div class="social">
<a href="https://github.com/zzzhan/bootstrap-colorpicker-plus/" target="_blank" class="btn btn-default btn-md"><i class="glyphicon glyphicon-random"></i> Fork me on Github</a>
<a href="https://github.com/zzzhan/bootstrap-colorpicker-plus/archive/master.zip" target="_blank" class="btn btn-success btn-md"><i class="glyphicon glyphicon-download-alt"></i> Download</a>
</div>
<br>
</article>
</div>
<div class="row">
<div class="col-md-12">
<h2>Examples</h2>
<p>Sample#1</p>
<div class="well">
<div class="input-group input-group-sm">
<input type="text" value="#fff" id="demo1"/>
</div>
<pre class="markup">
<input type="text" value="#fff" id="demo1" />
<script>
$(function(){
var demo1 = $('#demo1');
demo1.colorpickerplus();
demo1.on('changeColor', function(e){
if(e.color==null)
$(this).val('transparent').css('background-color', '#fff');//tranparent
else
$(this).val(e.color).css('background-color', e.color);
});
});
</script>
</pre>
</div>
<p>Sample#2</p>
<div class="well">
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-default" id="demo2"><span class="color-fill-icon dropdown-color-fill-icon" style="background-color:#000;"></span> <b class="caret"></b></button>
</div>
<pre class="markup">
<button type="button" class="btn btn-default" id="demo2">...</button>
<script>
$(function(){
var demo2 = $('#demo2');
demo2.colorpickerplus();
demo2.on('changeColor', function(e){
if(e.color==null) {
//when select transparent color
$('.color-fill-icon', $(this)).addClass('colorpicker-color');
} else {
$('.color-fill-icon', $(this)).removeClass('colorpicker-color');
$('.color-fill-icon', $(this)).css('background-color', e.color);
}
});
});
</script>
</pre>
</div>
<p>Sample#3</p>
<div class="well">
<input type="text" value="" id="demo3"/>
<div class="colorpickerplus-embed">
<div class="colorpickerplus-container"></div>
</div>
<pre class="markup">
<input type="text" value="#fff" id="demo3" />
<div class="colorpickerplus-embed">
<div class="colorpickerplus-container" </div>
</div>
<script>
$(function(){
var demo3 = $('.colorpickerplus-embed .colorpickerplus-container');
demo3.colorpickerembed();
demo3.on('changeColor', function(e){
if(e.color==null)
$('#demo3').val('transparent').css('background-color', '#fff');//tranparent
else
$('#demo3').val(e.color).css('background-color', e.color);
});
});
</script>
</pre>
</div>
<p>Sample#4</p>
<div class="well">
<div class="btn-group btn-group-sm colorpickerplus-dropdown" id="demo4">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="color-fill-icon dropdown-color-fill-icon"></span> <b class="caret"></b></button>
<ul class="dropdown-menu">
<li class="disabled"><div class="colorpickerplus-container"></div>
</li>
<li><a href="#">Other</a></li>
<li><a href="#">More...</a></li>
</ul>
</div>
<pre class="markup">
<div class="btn-group btn-group-sm colorpickerplus-dropdown" id="demo4">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">...</button>
<ul class="dropdown-menu">
<li class="disabled"><div class="colorpickerplus-container"></div>
</li>
<li>...</li>
</ul>
</div>
<script>
$(function(){
var demo4 = $('.colorpickerplus-dropdown .colorpickerplus-container');
demo4.colorpickerembed();
demo4.on('changeColor', function(e){
var el = $('.color-fill-icon', $('#demo4'));
if(e.color==null) {
//when select transparent color
el.addClass('colorpicker-color');
} else {
el.removeClass('colorpicker-color');
el.css('background-color', e.color);
}
});
});
</script>
</pre>
</div>
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="dist/js/bootstrap-colorpicker.min.js"></script>
<script src="dist/js/bootstrap-colorpicker-plus.js"></script>
<script type="text/javascript">
$(function(){
var demo1 = $('#demo1');
demo1.colorpickerplus();
demo1.on('changeColor', function(e,color){
if(color==null)
$(this).val('transparent').css('background-color', '#fff');//tranparent
else
$(this).val(color).css('background-color', color);
});
var demo2 = $('#demo2');
demo2.colorpickerplus();
demo2.on('changeColor', function(e,color){
if(color==null) {
//when select transparent color
$('.color-fill-icon', $(this)).addClass('colorpicker-color');
} else {
$('.color-fill-icon', $(this)).removeClass('colorpicker-color');
$('.color-fill-icon', $(this)).css('background-color', color);
}
});
var demo3 = $('.colorpickerplus-embed .colorpickerplus-container');
demo3.colorpickerembed();
demo3.on('changeColor', function(e,color){
if(color==null)
$('#demo3').val('transparent').css('background-color', '#fff');//tranparent
else
$('#demo3').val(color).css('background-color', color);
});
var demo4 = $('.colorpickerplus-dropdown .colorpickerplus-container');
demo4.colorpickerembed();
demo4.on('changeColor', function(e,color){
var el = $('.color-fill-icon', $('#demo4'));
if(color==null) {
//when select transparent color
el.addClass('colorpicker-color');
} else {
el.removeClass('colorpicker-color');
el.css('background-color', color);
}
});
});
</script>
</body>
</html>