equal
deleted
inserted
replaced
25 var color = {r: 0, g: 0, b: 0}; |
25 var color = {r: 0, g: 0, b: 0}; |
26 |
26 |
27 color[c] = 255; |
27 color[c] = 255; |
28 |
28 |
29 input.val(value.toString(16)); |
29 input.val(value.toString(16)); |
30 input.background_color(color.r, color.b, color.g, value / 255); |
30 input.background_color(color.r, color.g, color.b, value / 255); |
31 }); |
31 }); |
|
32 } |
|
33 |
|
34 function color_slider_input (input, c) { |
|
35 var value; |
|
36 |
|
37 if (input.val()) |
|
38 value = parseInt(input.val(), 16); |
|
39 else |
|
40 value = 0; |
|
41 |
|
42 $('#slider-' + c).slider('value', value); |
32 } |
43 } |
33 |
44 |
34 $(function () { |
45 $(function () { |
35 $('.color-slider').slider({ |
46 $('.color-slider').slider({ |
36 orientation: 'horizontal', |
47 orientation: 'horizontal', |
41 slide: color_slider_slide, |
52 slide: color_slider_slide, |
42 }); |
53 }); |
43 |
54 |
44 $(['r', 'g', 'b']).each(function (i, c) { |
55 $(['r', 'g', 'b']).each(function (i, c) { |
45 var input = $('#' + c); |
56 var input = $('#' + c); |
46 var value; |
|
47 |
57 |
48 if (input.val()) |
58 // bind |
49 value = parseInt(input.val(), 16); |
59 input.change(function () { color_slider_input($(this), this.id); }); |
50 else |
60 |
51 value = 0; |
61 // initialize |
52 |
62 color_slider_input(input, c); |
53 $('#slider-' + c).slider('value', value); |
|
54 }); |
63 }); |
55 }); |
64 }); |