Is it possible to show the displayed number within the knob with text on a separate line break?
I'm aware of the 'format' hook that can add text to the number, but would like to add a line break as well.
Is it possible to show the displayed number within the knob with text on a separate line break?
I'm aware of the 'format' hook that can add text to the number, but would like to add a line break as well.
It's pretty simple in fact. The plugin basically inserts formatted values into the Val of the input. However, if instead of an input you make a textarea then voila! You need to put the value inside the textarea (as textarea doesn't have the value attribute like inputs). My example:
<textarea class="dial" id="dll" data-displayPrevious="true" data-width="150" data-fgColor="#ccff00" data-font="Roboto" data-inputColor="#333">65</textarea>
and then call it like this
$("#dll").knob({readOnly:true,'format' : function (value) {
return parseInt($('#dll').val()) + ' people';
}, draw : function(){
$("#dll").css("font-size","19px");
}});
Make sure that you leave a space between the value and the text that needs to go on the other line (so that it can be wrapped - see at the ' people'). Also play around with the rows/cols and width of the knob in order to get it right (also text-wrap css).
My Text",` , `'format' : "\nMy Text",` though you may well run into alignment and/or overflow issues. – Roamer-1888 Oct 23 '14 at 22:01
to the string. It's not processed as html. And \n is just ignored. – Steven Harlow Oct 23 '14 at 23:34