Skip to content

Instantly share code, notes, and snippets.

@austinpray
Last active December 24, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinpray/6753515 to your computer and use it in GitHub Desktop.
Save austinpray/6753515 to your computer and use it in GitHub Desktop.
Extension for https://github.com/aterrien/jQuery-Knob adds a crude redraw method to the jQuery Knob plugin. Call $(elem).redrawKnob(); where elem is a container for your <input class="[settings.inputClass]"> Disclaimer, this method was written while under deadline. Improvements and suggestions welcome. Hopefully this is a temporary fix.

Redraw jQuery Knob

Extension for https://github.com/aterrien/jQuery-Knob adds a crude redraw method to the jQuery Knob plugin.

Call $(elem).redrawKnob(); where elem is a container for your

Disclaimer, this method was written while under deadline. Improvements and suggestions welcome. Hopefully this is a temporary fix.

/*
* redrawKnob()
* teeny tiny jquery plugin: adds a redraw method to knob
* REQUIRES: jquery.knob
* @austinpray 2013-09-29
*/
(function( $ ) {
$.fn.redrawKnob = function( options ) {
// defaults
var settings = $.extend({
inputClass: ".prof-pic-dial" // this is the default class stuck on your <input>
}, options );
//save input element, delete everything
//add saved input element, call knob
return this.each(function() {
var $inputElem = $(this).find(settings.inputClass).clone();
$(this)
.empty()
.append($inputElem)
.find(settings.inputClass)
.knob();
});
};
}( jQuery ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment