-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
57 lines (44 loc) · 1.33 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
<html>
<head>
<title>jQuery Lichtbrett Demo</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="jquery.lichtbrett.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.lichtbrett.css">
</head>
<body>
<h1>Color-Picker</h1>
<div id="colorpicker">
<div class="color active" style="background: red;"></div>
<div class="color" style="background: green;"></div>
<div class="color" style="background: blue;"></div>
<div class="color" style="background: yellow;"></div>
</div>
<h1>Lichtbrett</h1>
<div id="lichtbrett"></div>
<h1>Output</h1>
<textarea id="output"></textarea>
<script type="text/javascript">
var $lichtbrett = $('#lichtbrett');
// initialize Lichtbrett
$lichtbrett.lichtbrett({
clickable: true
});
// set some sample colors
$lichtbrett.lichtbrett([
[ 'red', 'red', 'blue', 'yellow', 'green' ],
[ 'yellow', 'green', '#CCC' ]
]);
// listen to events
$('.color').click(function() {
$(this).addClass('active');
$('.color').not($(this)).removeClass('active');
$lichtbrett.lichtbrett({
color: $(this).css('background-color')
});
});
$lichtbrett.bind('change', function(evnt, data) {
$('#output').text(JSON.stringify(data));
});
</script>
</body>
</html>