i found this var canvas = document.getElementById('canvasid'), width = canvas.width, height = canvas.height, ctx = canvas.getContext('2d'); function drawTimer(deg) { var x = width / 2, // center x y = height / 2, // center y radius = 100, startAngle = 0, endAngle = deg * (Math.PI/180), counterClockwise = true; ctx.clearRect(0, 0, height, width); ctx.save(); ctx.fillStyle = '#fe6'; // Set circle orientation ctx.translate(x, y); ctx.rotate(-90 * Math.PI/180); ctx.beginPath(); ctx.arc(0, 0, radius, startAngle, endAngle, counterClockwise); ctx.lineTo(0, 0); ctx.fill(); } setInterval(function() { // Determine the amount of time elapsed; converted to degrees var deg = (elapsedTime / totalTime) * 360; drawTimer(deg); }, 1000); var v, up=0,down=0,i=0 ,$idir = $("div.idir") ,$ival = $("div.ival") ,incr = function() { i++; $idir.show().html("+").fadeOut(); $ival.html(i); } ,decr = function() { i--; $idir.show().html("-").fadeOut(); $ival.html(i); }; $("input.infinite").knob( { min : 0 , max : 20 , stopper : false , change : function () { if(v > this.cv){ if(up){ decr(); up=0; }else{up=1;down=0;} } else { if(v < this.cv){ if(down){ incr(); down=0; }else{down=1;up=0;} } } v = this.cv; } });
This code not exactly for what i want but this for a timer (sort of clock).But i am sure how do i combine this piece and the original code. I have also attached index file and link to JS is http://test.eduvative.in/js/js/jquery.knob.js
index.html