forked from evoluteur/colorpicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
155 lines (133 loc) · 4.48 KB
/
demo.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
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>evol.colorpicker demo</title>
<link id="jquiCSS" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/ui-lightness/jquery-ui.css" type="text/css" media="all">
<link href="css/demo.css" rel="stylesheet" />
<link href="css/evol.colorpicker.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
<script src="js/evol.colorpicker.js" type="text/javascript"></script>
</head>
<body>
<h1 id="title">evol.colorpicker demo</h1>
<p>Theme:
<a href="#" class="css">le-frog</a> -
<a href="#" class="css">redmond</a> -
<a href="#" class="css">start</a> -
<a href="#" class="css">ui-darkness</a> -
<a href="#" class="css">ui-lightness</a>
</p>
<div class="demoPanel">
Inline (using a DIV tag):<br/>
<a href="#" id="getVal2">Get Value</a>
<a href="#" id="setVal2">Set Value</a><br/>
<a href="#" id="enable2">Enable</a>
<a href="#" id="disable2">Disable</a>
<a href="#" id="destroy2">Destroy</a><br/><br/>
<div id="cpDiv"></div>
</div>
<div class="demoPanel" style="width:130px">
Using "showOn" option:<br/><br/>
focus
<input id="cpFocus" value="#dbeef3" />
button
<input id="cpButton" value="#92cddc" />
both
<input id="cpBoth" value="#31859b" />
<a href="#" id="show">link</a>
<input id="cpOther" value="#002060" />
</div>
<div class="demoPanel" style="width:170px">
Event binding:<br/>
change.color and mouseover.color<br/><br/>
<input id="cp1"/><br/>
<a href="#" id="getVal">Get Value</a>
<a href="#" id="setVal">Set Value</a><br/>
<a href="#" id="enable">Enable</a>
<a href="#" id="disable">Disable</a>
<a href="#" id="destroy1">Destroy</a>
<br/>
</div>
<div class="demoPanel" style="width:130px">
No color indicator on the palette:<br/>
<br/>
<input id="noIndColor" value="#92cddc" /><br/>
</div>
<div class="demoPanel" style="width:130px">
In French:<br/>
<br/>
<input id="frenchColor" value="#92cddc" /><br/>
Using the "strings" option you can translate the colorpicker.<br/>
</div>
<div style="clear:both;"/>
<script>
$(document).ready(function(){
// Change theme
$('.css').click(function(){
$('#jquiCSS').attr('href','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/'+this.innerHTML+'/jquery-ui.css');
});
// Events demo
$('#cp1').colorpicker({color:'#8db3e2'})
.on('change.color', function(evt, color){
$('#title').attr('style','color:'+color);
})
.on('mouseover.color', function(evt, color){
$('#title').attr('style','background-color:'+color);
})
$('#getVal').click(function(){
alert($('#cp1').colorpicker("val"));
})
$('#setVal').click(function(){
$('#cp1').colorpicker("val",'#31859b');
})
$('#enable').click(function(){
$('#cp1').colorpicker("enable");
})
$('#disable').click(function(){
$('#cp1').colorpicker("disable");
})
$('#destroy1').click(function(){
var v=$('#cp1').colorpicker("destroy") ;
})
// Instanciate colorpickers
$('#cpBoth').colorpicker();
$('#cpDiv').colorpicker({color:'#31859b'});
$('#cpFocus').colorpicker({showOn:'focus'});
$('#cpButton').colorpicker({showOn:'button'});
$('#cpOther').colorpicker({showOn:'none'});
$('#show').click(function(evt){
evt.stopImmediatePropagation();
$('#cpOther').colorpicker("showPalette");
})
// No color indicator
$('#noIndColor').colorpicker({
displayIndicator: false
});
// French colorpicker
$('#frenchColor').colorpicker({
strings: "Couleurs de themes,Couleurs de base,Plus de couleurs,Moins de couleurs,Palette,Historique,Pas encore d'historique."
});
$('#getVal2').click(function(){
alert($('#cpDiv').colorpicker("val"));
})
$('#setVal2').click(function(){
$('#cpDiv').colorpicker("val",'#31859b');
})
$('#enable2').click(function(){
$('#cpDiv').colorpicker("enable");
})
$('#disable2').click(function(){
$('#cpDiv').colorpicker("disable");
})
$('#destroy2').click(function(){
var v=$('#cpDiv').colorpicker("destroy");
})
});
</script>
<p><br/>evol.colorpicker is released under the <a href="http://github.com/evoluteur/colorpicker/raw/master/LICENSE.md">MIT license</a>.</p>
<p>
Download and Source code available at GitHub <a href="https://github.com/evoluteur/colorpicker" target="download">https://github.com/evoluteur/colorpicker</a>.</p>
<br/><br/>
<div class="footer">© 2013 Olivier Giulieri</div>
</body>
</html>