0

I've searched for information to solve my problem with the JQuery Plugin named knob.js, but couldn't find anything which helps me.

Here are links to the plugin:

https://github.com/aterrien/jQuery-Knob

http://anthonyterrien.com/knob/

My problem is:

I want to take the value which is in the knob, to manipulate another element in my project.

I need something like:

var myVariable = value;
if(myVariable > 50){
        .....
    } else{
}

Here's my code:

<div id="zeitRegler">
<input 
class="knob"  
data-height="100%";
data-width="100%";
data-fgColor="#0090C5"
data-skin="tron"
data-thickness=".1"
data-angleOffset="180"
value="20"> 
<script src="jquery.min.js"></script>
<script src='jquery.knob.min.js'></script>
<script>
$(function () {
    $('.knob').knob({
        draw: function () {
            if (this.$.data('skin') == 'tron') {
                this.cursorExt = 0.3;
                var a = this.arc(this.cv);
                var pa;
                var r = 1;
                this.g.lineWidth = this.lineWidth;
                if (this.o.displayPrevious) {
                    pa = this.arc(this.v);
                    this.g.beginPath();
                    this.g.strokeStyle = this.pColor;
                    this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
                    this.g.stroke();
                }
                this.g.beginPath();
                this.g.strokeStyle = r ? this.o.fgColor : this.fgColor;
                this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
                this.g.stroke();
                this.g.lineWidth = 2;
                this.g.beginPath();
                this.g.strokeStyle = this.o.fgColor;
                this.g.arc(this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
                this.g.stroke();
                return false;
            }
        }
    });
});




</script
paisanco
  • 4,098
  • 6
  • 27
  • 33
Rob
  • 11
  • 1

1 Answers1

1

There is example in the github documentation:

$(".knob").knob({
    'change' : function (v) { alert("The new value is: " + v); }
});
aleksandar
  • 2,399
  • 2
  • 14
  • 22