Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. jQuery Knob
  2. =============
  3. - canvas based ; no png or jpg sprites.
  4. - touch, mouse and mousewheel, keyboard events implemented.
  5. - downward compatible ; overloads an input element.
  6. Example
  7. -------
  8. <input type="text" value="75" class="dial">
  9. <script>
  10. $(function() {
  11. $(".dial").knob();
  12. });
  13. </script>
  14. Options
  15. -------
  16. Options are provided as attributes 'data-option':
  17. <input type="text" class="dial" data-min="-50" data-max="50">
  18. ... or in the "knob()" call :
  19. $(".dial").knob({
  20. 'min':-50
  21. ,'max':50
  22. });
  23. The following options are supported :
  24. Behaviors :
  25. * min : min value | default=0.
  26. * max : max value | default=100.
  27. * step : step size | default=1.
  28. * angleOffset : starting angle in degrees | default=0.
  29. * angleArc : arc size in degrees | default=360.
  30. * stopper : stop at min & max on keydown/mousewheel | default=true.
  31. * readOnly : disable input and events | default=false.
  32. * rotation : direction of progression | default=clockwise.
  33. UI :
  34. * cursor : display mode "cursor", cursor size could be changed passing a numeric value to the option, default width is used when passing boolean value "true" | default=gauge.
  35. * thickness : gauge thickness.
  36. * lineCap : gauge stroke endings. | default=butt, round=rounded line endings
  37. * width : dial width.
  38. * displayInput : default=true | false=hide input.
  39. * displayPrevious : default=false | true=displays the previous value with transparency.
  40. * fgColor : foreground color.
  41. * inputColor : input value (number) color.
  42. * font : font family.
  43. * fontWeight : font weight.
  44. * bgColor : background color.
  45. Hooks
  46. -------
  47. <script>
  48. $(".dial").knob({
  49. 'release' : function (v) { /*make something*/ }
  50. });
  51. </script>
  52. * 'release' : executed on release
  53. Parameters :
  54. + value : int, current value
  55. * 'change' : executed at each change of the value
  56. Parameters :
  57. + value : int, current value
  58. * 'draw' : when drawing the canvas
  59. Context :
  60. - this.g : canvas context 2D (see Canvas documentation)
  61. - this.$ : jQuery wrapped element
  62. - this.o : options
  63. - this.i : input
  64. - ... console.log(this);
  65. * 'cancel' : triggered on [esc] keydown
  66. * 'format' : allows to format output (add unit %, ms ...)
  67. The scope (this) of each hook function is the current Knob instance (refer to the demo code).
  68. Example
  69. -------
  70. <input type="text" value="75" class="dial">
  71. <script>
  72. $(".dial").knob({
  73. 'change' : function (v) { console.log(v); }
  74. });
  75. </script>
  76. Dynamically configure
  77. -------
  78. <script>
  79. $('.dial')
  80. .trigger(
  81. 'configure',
  82. {
  83. "min":10,
  84. "max":40,
  85. "fgColor":"#FF0000",
  86. "skin":"tron",
  87. "cursor":true
  88. }
  89. );
  90. </script>
  91. Set the value
  92. -------
  93. <script>
  94. $('.dial')
  95. .val(27)
  96. .trigger('change');
  97. </script>
  98. Supported browser
  99. -------
  100. Tested on Chrome, Safari, Firefox, IE>=8.0 (IE8.0 with excanvas).
  101. ![secretplan](https://raw.github.com/aterrien/jQuery-Knob/master/secretplan.jpg)