Ad

Change Width Of Farbtastic Color Picker Does Not Work For Me

- 1 answer

i tried really hard to change the width and height of the farbtastic color picker without success.... JS is not my language

Can someone please help me out

I tried every possible solution on 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>
Ad

Answer

The width and height are hard coded into the plugin source. Just refer to the plugin source from the repo. https://rawgit.com/mattfarina/farbtastic/master/src/farbtastic.js

This should work

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

Here is working demo.

Ad
source: stackoverflow.com
Ad