christianesperar 89d7f6df20 Update libraries | 8 years ago | |
---|---|---|
.. | ||
dist | 8 years ago | |
js | 8 years ago | |
.bower.json | 8 years ago | |
.gitignore | 8 years ago | |
LICENSE | 8 years ago | |
README.md | 8 years ago | |
bower.json | 8 years ago | |
excanvas.js | 8 years ago | |
index.html | 8 years ago | |
knob.jquery.json | 8 years ago | |
package.json | 8 years ago | |
secretplan.jpg | 8 years ago |
<input type="text" value="75" class="dial">
<script>
$(function() {
$(".dial").knob();
});
</script>
Options are provided as attributes 'data-option':
<input type="text" class="dial" data-min="-50" data-max="50">
... or in the "knob()" call :
$(".dial").knob({
'min':-50,
'max':50
});
The following options are supported :
Behaviors :
UI :
<script>
$(".dial").knob({
'release' : function (v) { /*make something*/ }
});
</script>
'release' : executed on release
Parameters :
'change' : executed at each change of the value
Parameters :
'draw' : when drawing the canvas
Context :
'cancel' : triggered on [esc] keydown
'format' : allows to format output (add unit %, ms ...)
The scope (this) of each hook function is the current Knob instance (refer to the demo code).
<input type="text" value="75" class="dial">
<script>
$(".dial").knob({
'change' : function (v) { console.log(v); }
});
</script>
<script>
$('.dial').trigger(
'configure',
{
"min":10,
"max":40,
"fgColor":"#FF0000",
"skin":"tron",
"cursor":true
}
);
</script>
<script>
$('.dial')
.val(27)
.trigger('change');
</script>
Tested on Chrome, Safari, Firefox, IE>=8.0 (IE8.0 with excanvas).