如何更改 Farbtastic 拾色器轮的宽度和高度?

How can I change the width and height of Farbtastic Color Picker Wheel?

Farbastic Github Documentation上提到Farbtastic Color Picker的Width和Height可以这样修改;

$(...).farbtastic({ callback: '#color2', width: 150 })

但是,我无法自定义 Farbtastic 拾色器的宽度和高度。这是我的代码;

colorPickerWheel = $.farbtastic("#colorPickerWheel", { width: 500, height: 500 });
colorPickerWheel.linkTo(pickerUpdate);

function pickerUpdate(color){
    console.log("Color Picker Wheel: " + color);
}

等待回复,谢谢!

显然,如果您省略 callback 参数,则 widthheight 不会被拾取(这可能是一个错误)。但是,您可以通过在初始化时在选项对象中传递 callback: pickerUpdate 来解决它。

var colorPickerWheel = $.farbtastic("#colorPickerWheel", {callback: pickerUpdate, width: 500, height: 500});

colorPickerWheel.setColor('#00ffff');

function pickerUpdate(color){
    console.log("Color Picker Wheel: " + color);
}

https://jsfiddle.net/s2zhgsbr/1/

它已经过测试并且适合我

$.farbtastic("#colorPickerWheel", { callback: pickerUpdate,width: 500,  height: 500 });