Sha256: d9da1065738eecca006a9d16c9de3c8d07cb7e88a8f72d90c85414d463d4c77f
Contents?: true
Size: 1004 Bytes
Versions: 4
Compression:
Stored size: 1004 Bytes
Contents
/* global Fae, colorpicker, FCH */ /** * Fae form color * @namespace form.color * @memberof form */ Fae.form.color = { init: function() { this.initColorpicker(); }, /** * Initialize colorpicker */ initColorpicker: function(e) { var includeAlphaSlider = $('.alpha-slider').length > 0 var settings = { opacity: includeAlphaSlider, positionCallback: function($elm) { var inputOffset = $elm.offset().top; var distanceToBottom = $(document).height() - inputOffset; var top = distanceToBottom <= this.$UI._height ? 414 : inputOffset + $elm.innerHeight(); var left = $elm.offset().left; return { left: left, top: top } }, renderCallback: function($elm, toggled) { var colors = this.color.colors; // default to HEX if Alpha is 1 if ($elm.val() && colors.alpha > 0.9) { $elm.val('#' + colors.HEX); } } } $('.js-color-picker').colorPicker(settings); } };
Version data entries
4 entries across 4 versions & 2 rubygems