2
0
mirror of https://github.com/PitPik/colorPicker.git synced 2025-09-24 16:40:57 -06:00

Update jsColor.js

use getBoundingClientRect instead of element offset to account for absolute positioned elements.
This commit is contained in:
calebroseland 2016-02-01 09:37:37 -05:00
parent 720786e309
commit 9b004c41f3

View File

@ -98,7 +98,8 @@
var onOff = off ? 'removeEventListener' : 'addEventListener',
focusListener = function(e) {
var input = this,
position = {left: input.offsetLeft, top: input.offsetTop},
inputRect = input.getBoundingClientRect(),
position = {left: inputRect.left, top: inputRect.top},
index = multiple ? Array.prototype.indexOf.call(elms, this) : 0,
colorPicker = colorPickers[index] ||
(colorPickers[index] = createInstance(this, config)),
@ -226,4 +227,4 @@
(options.secure ? '; secure' : '');
}
};
})(this);
})(this);