From fa2b38c823bd9795b2aabff574e2ddb9fb7a3886 Mon Sep 17 00:00:00 2001 From: Luc Castera Date: Sat, 23 Jan 2016 15:02:26 -0500 Subject: [PATCH] Added a displayMax option to show max value under input --- README.md | 2 ++ js/jquery.knob.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 2257ff4..21ad126 100755 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ UI : * height : dial height. * displayInput : default=true | false=hide input. * displayPrevious : default=false | true=displays the previous value with transparency. +* displayMax: default=false | true=displays a line under this input with + the max value. * fgColor : foreground color. * inputColor : input value (number) color. * font : font family. diff --git a/js/jquery.knob.js b/js/jquery.knob.js index 792313c..b8edfde 100644 --- a/js/jquery.knob.js +++ b/js/jquery.knob.js @@ -113,6 +113,7 @@ height: this.$.data('height') || 200, displayInput: this.$.data('displayinput') == null || this.$.data('displayinput'), displayPrevious: this.$.data('displayprevious'), + displayMax: this.$.data('displaymax'), fgColor: this.$.data('fgcolor') || '#87CEEB', inputColor: this.$.data('inputcolor'), font: this.$.data('font') || 'Arial', @@ -723,6 +724,21 @@ 'width': '0px', 'visibility': 'hidden' }); + + if (this.o.displayInput && this.o.displayMax) { + this.i.after('of ' + this.o.max + '> 0) + 'px' + ,'height' : ((this.o.width / 12) >> 0) + 'px' + ,'position' : 'absolute' + ,'font-size': '16px;' + ,'margin-top' : ((this.o.width / 3) >> 0) + ((this.o.width / s) >> 0) + 5 + 'px' + ,'margin-left' : '-' + ((this.o.width * 3 / 4 + 2) >> 0) + 'px' + ,'text-align': 'center' + ,'color': '#ccc' + }); + } }; this.change = function (v) { @@ -803,3 +819,5 @@ }; })); + +