Questions tagged [jquery-knob]

An jQuery-based spinner/dial control.

jQuery Knob canvas based ; no png or jpg sprites. touch, mouse and mousewheel, keyboard events implemented. downward compatible ; overloads an input element.

Useful links:

Example

<input type="text" value="75" class="dial">

$(function() {
    $(".dial").knob();
}

enter image description here

Options

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 :

    • min : min value | default=0.
    • max : max value | default=100.
    • angleOffset : starting angle in degrees | default=0.
    • angleArc : arc size in degrees | default=360.
    • stopper : stop at min & max on keydown/mousewheel | default=true.
    • readOnly : disable input and events | default=false.

  • UI :
    • cursor : display mode "cursor" | default=gauge.
    • thickness : gauge thickness.
    • width : dial width.
    • displayInput : default=true | false=hide input.
    • displayPrevious : default=false | true=displays the previous value with transparency.
    • fgColor : foreground color.
    • bgColor : background color.

  • Hooks

    $(".dial").knob({ 'release' : function (v) { /make something/ } });

  • 'release' : executed on release

    Parameters :

    value : int, current value


- 'change' : executed at each change of the value
Parameters :

value : int, current value
'draw' : when drawing the canvas


The scope (this) of each hook function is the current Knob instance (refer to the demo code).

Example

<input type="text" value="75" class="dial">

<script>
$(".dial").knob({
                 'change' : function (v) { console.log(v); }
                });
</script>

Dynamically configure

<script>
$('.dial')
    .trigger(
        'configure',
        {
        "min":10,
        "max":40,
        "fgColor":"#FF0000",
        "skin":"tron",
        "cursor":true
        }
    );
</script>

Set the value

<script>
$('.dial')
    .val(27)
    .trigger('change');
</script>

Supported browser Tested on Chrome, Safari, Firefox, IE 9.0.

145 questions
0
votes
2 answers

how to add image for fgcolor in jquery knob

I know jquery knob is canvas based. Still I want to know any other chances to add image for fgcolor and cursor in jquery knob. Like I need pointer image to drag. So any chances to acheive that??? correct me If I am wrong. I want to make jquery knob…
0
votes
1 answer

jQuery Knob as a Progress Bar on hover in/out

I'm trying to implement a progress bar (aterrien's jQuery Knob) that can have its progression interrupted on mouseout. I can begin the progression on mouseover, but I cannot interrupt the progression until it's been completed. I'd like to reverse…
Daniel Sussman
  • 257
  • 3
  • 11
0
votes
1 answer

How to use Jquery knob like text label with highchart Jquery plugin

I am using highchart plugin and like it very much. I am using chart type: PIE , feature of highcharts. I want to add a label which displays the value of the clicked region of pie chart inside that label just like in jquery knob. for example when we…
Shivek Parmar
  • 2,865
  • 2
  • 33
  • 42
0
votes
1 answer

JQuery Knob, Stop knob value from changing while using touch or mouse

I am using Knob for a climate control app. Every 10 seconds my script sends an ajax request to get the setPoint (variable of what the requested room temp should be to reach satisfied) from XML, and then this updates the knob value. I am also using…
fbiss
  • 11
  • 3
0
votes
1 answer

data-step attribute not working in jquery knob

How to change data-step attribute in jQuery knob. I have tried data-step="25" in input html tag, but it's not working. Here is the jsfiddle http://jsfiddle.net/vishnur15/6SH5t/
VishnuPrasad
  • 1,078
  • 5
  • 17
  • 36
0
votes
1 answer

dynamically Controlling a Knob With Another one jQuery

I have two knobs, I would like to control dynamically the value of the first one when moving the second one. so far I have: (First Knob) $('#inf-knob').knobRot({ classes: ['inf-knob'], frameWidth: 250, …
SNos
  • 3,430
  • 5
  • 42
  • 92
0
votes
1 answer

jQuery Knob displays NaN when value is 0

It's really weird. $(function(){ $('.dial').knob({ return value + '%'; }); }); That was my original code to get the percent sign to show up, which works great. For some reason, when the value is 0, on page load it displays as NaN.…
Matt MacLeod
  • 438
  • 2
  • 5
  • 17
0
votes
1 answer

Knob.js as a progressbar for Soundmanager2

I am trying to use Knob.js (http://anthonyterrien.com/knob/) as a progress bar. I have found code for soundmanager2 $(".progBar").css('width', ((this.position/this.duration) * 100) + '%'); That works for a normal div width progress bar, but…
jeanhules
  • 235
  • 5
  • 16
0
votes
1 answer

Round integer number to 1 decimal

I am using Jquery Knob and the input value is change through sliders. window.onload = function(){ var elements=document.querySelectorAll('input[type=range]') for(var i = 0; i < elements.length; i++){ …
0
votes
1 answer

Knob JS: Change data-max value dynamically

I am using Knob JS and need to change the dial value and also the maximum value. Knob is implemented as: And I change the value dynamically using: