PitPik / tinyColorPicker

Tiny jQuery color picker for mobile and desktop with alpha channel
http://www.dematte.at/tinyColorPicker/
MIT License
276 stars 77 forks source link

How to enable picker in flat mode? #45

Closed ramnel closed 8 years ago

ramnel commented 8 years ago

Hi,

Is there anyway for the color picker to be initialized in flat mode (without the use of triggers)?

Cheers!

PitPik commented 8 years ago

Hi @ramnel , unfortunately tinyColorPicker can't do this by default. It was meant to be a picker for input fields and other elements,... my other project https://github.com/PitPik/colorPicker can be run in 'flat mode' if you don't use its 'implementations'. Just see how it's done in the demo.

Well, there is a dirty tweak you could use to make it look like being a 'flat' color picker: You place a input field somewhere on the page (where you want the color picker to appear) set the width / height to 0 or opacity to 0 (or how ever you want it to disappear) and then go:

var $patch = $('#color'); // #color is your hidden input
var patch = $patch[0]; // plain element without jQuery
var myColorPicker = $patch.colorPicker({animationSpeed: 0}); // your instance

myColorPicker.colorPicker.toggle.call(patch, 1); // let it appear
$(document.body).off('.a'); // this turns off the toggle (on / off)

Hope this helps Cheers

ramnel commented 8 years ago

Hi @PitPik , Thanks for your help, well this is one neat tweak! The idea might help me solve my current issue and may serve as future reference to others as well.

You have amazing variations of colorPickers :)