From 6a3b244bb72f1037f4108ccf025c8ca5273b3d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Dematt=C3=A9?= Date: Fri, 13 Nov 2015 22:23:58 +0100 Subject: [PATCH] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 613eade..c64e437 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,21 @@ $('.color').colorPicker({ body: document.body // the element where the events are attached to (touchstart, mousedown, pointerdown, focus, click, change) }); ``` +####Some tips + +The renderCallback can be used as openCallback and closeCallback: + +```javascript +renderCallback: function($elm, toggled) { + if (toggled === true) { // simple, lightweight check + // ... like an open callback + } else if (toggled === false) { + // ... like a close callback + } +} +``` +Here you can fire events if necessary or check for a className or data attribute on $elm to see if there is a hint for hiding the opacity slider: ```this.$UI.find('.cp-alpha').toggle(!$elm.hasClass('no-alpha'));``` + ##colors.js This section only shows the options for color.js. They are picked up automatically if set in $('.color').colorPicker