简体   繁体   中英

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.

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.

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; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM