How to change font size in JQuery knob
Asked Answered
J

1

6

I have a problem in jQuery Knob plugin.I want to change the font size inside the circle and change the content of the input text.

Jasmine answered 9/3, 2015 at 16:42 Comment(0)
S
9

The only way I can seem to do this tidily is to hook on the draw function, and use the i property to set the style of the input. For example, here is one applying a CSS property to rotate the input element and set the font size.

$(".dial").knob({
    'min':-50,
    'max':50,
    'draw': function() {
        $(this.i).css('transform', 'rotate(180deg)').css('font-size', '10pt');
      }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://anthonyterrien.com/js/jquery.knob.js"></script>
<input type="text" class="dial" data-min="-50" data-max="50" />
Spittle answered 9/3, 2015 at 16:56 Comment(1)
If I want to add text under the value of input for example i have 23% consumed i want (consumed) under 23% inside the circle but (consumed) in different font size.Jasmine

© 2022 - 2024 — McMap. All rights reserved.