monmon a721dfe38c navbar fix | il y a 5 ans | |
---|---|---|
.. | ||
dist | il y a 5 ans | |
js | il y a 5 ans | |
.bower.json | il y a 5 ans | |
LICENSE | il y a 5 ans | |
README.md | il y a 5 ans | |
bower.json | il y a 5 ans | |
excanvas.js | il y a 5 ans | |
index.html | il y a 5 ans | |
knob.jquery.json | il y a 5 ans | |
package.json | il y a 5 ans | |
secretplan.jpg | il y a 5 ans |
<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).