Skip to content

Commit de7b83d

Browse files
committed
README.md
1 parent cad36a5 commit de7b83d

File tree

1 file changed

+81
-44
lines changed

1 file changed

+81
-44
lines changed

README.md

Lines changed: 81 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
jQuery Knob
22
=============
33

4-
- canvas based ; no png or jpg sprites
5-
- touch, mousewheel, keyboard events implemented
6-
- downward compatible ; overloads an input element
4+
- canvas based ; no png or jpg sprites.
5+
- touch, mousewheel, keyboard events implemented.
6+
- downward compatible ; overloads an input element.
7+
8+
Example
9+
-------
10+
11+
<input type="text" value="75" class="dial">
12+
13+
<script>
14+
$(function() {
15+
$(".dial").knob();
16+
}
17+
</script>
718

819
Options
920
-------
@@ -12,23 +23,35 @@ Options are provided as attributes 'data-option':
1223

1324
<input type="text" class="dial" data-min="-50" data-max="50">
1425

26+
... or in the "knob()" call :
27+
28+
$(".dial").knob({
29+
'min':-50
30+
,'max':50
31+
})
32+
1533
The following options are supported :
1634

17-
* min : min value
18-
* max : max value
19-
* cursor : display mode "cursor" | default=gauge
20-
* thickness : gauge thickness
21-
* width : dial width
22-
* displayInput : default=true | false=hide input
23-
* fgColor : foreground color
24-
* bgColor : background color
25-
* ticks : number of ticks | 0=disable
26-
* tickColor
27-
* tickLength
28-
* tickWidth
29-
* tickColorizeValues : colorize ticks
30-
* readOnly : disable input and events
31-
* skin : default | "tron"
35+
Behaviors :
36+
* min : min value || default=0.
37+
* max : max value || default=100.
38+
* stopper : stop at 0 & 100 on keydown/mousewheel || default=true.
39+
* readOnly : disable input and events.
40+
41+
UI :
42+
* cursor : display mode "cursor" | default=gauge.
43+
* thickness : gauge thickness.
44+
* width : dial width.
45+
* displayInput : default=true | false=hide input.
46+
* displayPrevious : default=false | true=displays the previous value with transparency.
47+
* fgColor : foreground color.
48+
* bgColor : background color.
49+
* ticks : number of ticks | 0=disable.
50+
* tickColor.
51+
* tickLength.
52+
* tickWidth.
53+
* tickColorizeValues : colorize ticks.
54+
* skin : default | "tron".
3255

3356
Hooks
3457
-------
@@ -39,32 +62,26 @@ Hooks
3962
});
4063
</script>
4164

42-
* 'release' : executed on release.
65+
* 'release' : executed on release
4366

44-
Parameters :
45-
- value : int, current value
46-
- input : jQuery element, input element
67+
Parameters :
68+
value : int, current value
69+
input : jQuery element, input element
4770

4871
* 'change' : executed at each change of the value
4972

50-
Parameters :
51-
- value : int, current value
73+
Parameters :
74+
value : int, current value
5275

5376
* 'draw' : when drawing the canvas
5477

55-
Example 1
56-
-------
57-
58-
<input type="text" value="75" class="dial">
78+
Parameters :
79+
angle : computed angle
80+
value : current value
81+
opt : plugin options
82+
context : Canvas context 2d
5983

60-
<script>
61-
$(function() {
62-
$(".dial").knob();
63-
}
64-
</script>
65-
66-
67-
Example 2
84+
Example
6885
-------
6986

7087
<input type="text" value="75" class="dial">
@@ -76,19 +93,39 @@ Example 2
7693
console.log(e);
7794
}
7895
}
79-
)
80-
.val(79);
96+
);
8197
</script>
8298

8399

84-
Tested on Chrome, Safari, Firefox.
85-
Not tested on MSIE.
100+
Dynamically configure
101+
-------
86102

103+
<script>
104+
$('.dial').trigger('configure',{"min":10, "max":40, "fgColor":"#FF0000", "skin":"tron", "cursor":true})
105+
</script>
106+
107+
Supported browser
108+
-------
109+
110+
Tested on Chrome, Safari, Firefox, IE 9.0.
111+
112+
Revision 1.1.2
113+
-------
114+
- removed padding around the wheel in default skin / default thickness = 0.35.
115+
- 'configure' event.
116+
- added 'displayPrevious' option.
117+
- change color cgColor / 'displayPrevious' must be true.
118+
- escape keycode supported while changing = restore the current value.
119+
- tab keycode supported.
120+
- added 'stopper'.
121+
- bugfix init when 'value' attribute is not defined.
122+
- JSLint qa.
123+
- infinite mode demo.
87124

88125
Revision 1.1.1
89126
-------
90-
- keyboard/mousewheel control refactoring / acceleration
91-
- bugfix no keyboard or mousewheel when readonly
92-
- bugfix min/max can be exceeded
93-
- hooks / keyboard events
127+
- keyboard/mousewheel control refactoring / acceleration.
128+
- bugfix no keyboard or mousewheel when readonly.
129+
- bugfix min/max can be exceeded.
130+
- hooks / keyboard events.
94131

0 commit comments

Comments
 (0)