更改farbtastic颜色选择器的宽度对我不起作用

Change width of farbtastic color picker does not work for me

本文关键字:不起作用 farbtastic 颜色 选择器 更改      更新时间:2023-09-26

我非常努力地更改farbtastic颜色选择器的宽度和高度,但没有成功。。。。JS不是我的语言

有人能帮我一下吗

我尝试了所有可能的解决方案http://liveweave.comhtml在线编辑器

<!DOCTYPE html>
 <html>
  <head>
   <title>HTML5, CSS3 and JavaScript demo</title>
   <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js'></script>
   <script type='text/javascript' src='http://gilbertsincobh.com/wp-content/plugins/revslider/js/farbtastic/farbtastic.js'></script>
   <link rel='stylesheet' href='http://gilbertsincobh.com/wp-content/plugins/revslider/js/farbtastic/farbtastic.css' type='text/css' />
   <script type='text/javascript'>
    $(document).ready(function(){
                          $('#demo').hide();
                          $('#picker').farbtastic('#color');
                          $.farbtastic("#picker", {callback: pickerUpdate, width: 600, height: 600});
                          function pickerUpdate(color){console.log("Color Picker Wheel: " + color);
                                }
                     );
   </script> 
  </head>
  <body>
   <div id="picker"></div>
  </body>
</html>

宽度和高度被硬编码到插件源代码中。只需参考repo中的插件源代码即可。https://rawgit.com/mattfarina/farbtastic/master/src/farbtastic.js

这应该工作

$(function () {
    $('#colorpicker1').farbtastic('#color1');
    $('#colorpicker2').farbtastic({ callback: '#color2', width: 150 });
});

这是工作演示