jquery颜色选择器:tinyColorPicker
y37f
10年前
tinyColorPicker是jquery实现快速可扩展灵活的支持移动和桌面的颜色选择器。支持触摸或手标响应,GPU加速渲染,丰富颜色模型及API。
$('.color').colorPicker({ color: ..., // see Colors... customBG: '#FFF' // see Colors... animationSpeed: 150, // toggle animation speed GPU: true, // use transform: translate3d doRender: true | 'selector', // manipulate color and bgColor of input field (on certain elements if selector) opacity: true, // enable / disable alpha slider renderCallback: function($elm, toggled) {}, // this === instance; $elm: the input field;toggle === true -> just appeared; false -> opposite; else -> is rendering on pointer move // toggled true/false can for example be used to check if the $elm has a certain className and then hide alpha,... buidCallback: function($elm) {}, // this === instance; $elm: the UI css: '', // replaces existing css cssAddon: '', // adds css to existing margin: '', // positioning margin (can also be set in cssAddon) scrollResize: true // toggle for reposition colorPicker on window.resize/scroll gap: 4 // gap to right and bottom edge of view port if repositioned to fit preventFocus: false // prevents default on focus of input fields (e.g. no keyboard on mobile) body: document.body // the element where the events are attached to (touchstart, mousedown, pointerdown, focus, click, change) });