Ing. Michal Hudak
Ing. Michal Hudak

Reputation: 5612

jquery knob change colors with CSS

I am using jQuery knob plugin.

Source: http://anthonyterrien.com/knob/

I am aware of it's options, that you can edit in JS file.

Question:

How to change colors ( fgColor, bgColor ) with CSS ?

HTML:

<input type="text" value="1" class="dial">

JS:

$(function() {
    $(".dial").knob({
        readOnly: true,
        fgColor: '#009900',
        bgColor: '#00ff00'
    });
});

CSS:

.dial {
// options
}

Thank you for your suggestions.

Upvotes: 0

Views: 2490

Answers (2)

Mohammed Abo Elwafa
Mohammed Abo Elwafa

Reputation: 21

i manage to change only the numbers in it but still canot change the circle

you just put this line in your .css and it will change the color

.dial { color: #ff3738 !important; }

Upvotes: -1

malifa
malifa

Reputation: 8165

This Plugin seems to put a canvas above your input. So what you want to achieve is to change the color of the stuff drawn in that canvas. Since you can't manipulate the contents of a canvas with css, you aren't able to change the colors without using Javascript.

Upvotes: 2

Related Questions