Browse Source

avoid carrot to jump

pull/25/head
peterd 7 years ago
parent
commit
6f7fd42860
  1. 1
      index.html
  2. 11
      jqColorPicker.js
  3. 2
      jqColorPicker.js.map
  4. 2
      jqColorPicker.min.js

1
index.html

@ -112,6 +112,7 @@ window.myColorPicker = $('input.color').colorPicker({
margin: '4px -2px',
doRender: 'div div',
preventFocus: true,
animationSpeed: 0,
// demo on how to make plugins... mobile support plugin
buidCallback: function($elm) {

11
jqColorPicker.js

@ -64,6 +64,8 @@
position;
if (event) {
// if (this.nodeName.toLowerCase() === 'input' &&
// event.type === 'click') return;
// _options.preventFocus && this.blur();
position = $this.offset();
_cache.$element = findElement($this);
@ -161,7 +163,8 @@
HSL = colors.RND.hsl,
dark = '#222',
light = '#ddd',
colorMode = _cache.$element.data('colorMode'),
$element = _cache.$element,
colorMode = $element.data('colorMode'),
isAlpha = colors.alpha !== 1,
alpha = Math.round(colors.alpha * 100) / 100,
RGBInnerText = RGB.r + ', ' + RGB.g + ', ' + RGB.b,
@ -199,12 +202,12 @@
left: !_GPU ? a : '',
borderColor : alphaContrast + ' transparent'
});
_options.doRender && _cache.$element.css({
_options.doRender && $element.css({
backgroundColor : text,
color: colors.rgbaMixBGMixCustom.luminance > 0.22 ? dark : light
});
_cache.$element.val(text);
$element.val() !== text && $element.val(text); // avoids carret jump
// faster version (more than 2.5x)... though, no jQuery (colors, ...)
@ -234,7 +237,7 @@
_options.renderCallback.call(
_colorPicker,
_cache.$element,
$element,
typeof toggled === 'boolean' ? toggled : undefined
);
}

2
jqColorPicker.js.map
File diff suppressed because it is too large
View File

2
jqColorPicker.min.js
File diff suppressed because it is too large
View File

Loading…
Cancel
Save