1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
---|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Farbtastic</title> |
---|
6 | <script type="text/javascript" src="jquery.js"></script> |
---|
7 | <script type="text/javascript" src="farbtastic.js"></script> |
---|
8 | <link rel="stylesheet" href="farbtastic.css" type="text/css" /> |
---|
9 | <style type="text/css" media="screen"> |
---|
10 | .colorwell { |
---|
11 | border: 2px solid #fff; |
---|
12 | width: 6em; |
---|
13 | text-align: center; |
---|
14 | cursor: pointer; |
---|
15 | } |
---|
16 | body .colorwell-selected { |
---|
17 | border: 2px solid #000; |
---|
18 | font-weight: bold; |
---|
19 | } |
---|
20 | </style> |
---|
21 | |
---|
22 | <script type="text/javascript" charset="utf-8"> |
---|
23 | $(document).ready(function() { |
---|
24 | $('#demo').hide(); |
---|
25 | var f = $.farbtastic('#picker'); |
---|
26 | var p = $('#picker').css('opacity', 0.25); |
---|
27 | var selected; |
---|
28 | $('.colorwell') |
---|
29 | .each(function () { f.linkTo(this); $(this).css('opacity', 0.75); }) |
---|
30 | .focus(function() { |
---|
31 | if (selected) { |
---|
32 | $(selected).css('opacity', 0.75).removeClass('colorwell-selected'); |
---|
33 | } |
---|
34 | f.linkTo(this); |
---|
35 | p.css('opacity', 1); |
---|
36 | $(selected = this).css('opacity', 1).addClass('colorwell-selected'); |
---|
37 | }); |
---|
38 | }); |
---|
39 | </script> |
---|
40 | </head> |
---|
41 | <body> |
---|
42 | <h1>jQuery Color Picker: Farbtastic</h1> |
---|
43 | |
---|
44 | <div id="demo" style="color: red; font-size: 1.4em">jQuery.js is not present. You must install jQuery in this folder for the demo to work.</div> |
---|
45 | |
---|
46 | <form action="" style="width: 500px;"> |
---|
47 | <div id="picker" style="float: right;"></div> |
---|
48 | <div class="form-item"><label for="color1">Color 1:</label><input type="text" id="color1" name="color1" class="colorwell" value="#123456" /></div> |
---|
49 | <div class="form-item"><label for="color2">Color 2:</label><input type="text" id="color2" name="color2" class="colorwell" value="#123456" /></div> |
---|
50 | <div class="form-item"><label for="color3">Color 3:</label><input type="text" id="color3" name="color3" class="colorwell" value="#123456" /></div> |
---|
51 | |
---|
52 | </form> |
---|
53 | |
---|
54 | <p>More info on <a href="http://www.acko.net/dev/farbtastic">Acko.net</a>.</p> |
---|
55 | <p>Created by <a href="http://www.acko.net/">Steven Wittens</a>.</p> |
---|
56 | </body> |
---|
57 | </html> |
---|