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

时间:2016-01-04 00:35:45

标签: javascript jquery css farbtastic

我试着很难改变farbtastic颜色选择器的宽度和高度而没有成功.... JS不是我的语言

有人可以帮帮我吗

我在http://liveweave.com html-online-editor

上尝试了所有可能的解决方案
<!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>

1 个答案:

答案 0 :(得分:0)

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

这应该有效

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

Here is working demo.