appendTo different from document.body causes wrong placement using jsColorPicker
Opened this issue · 2 comments
shooshx commented
If I pass jsColorPicker() an appendTo element that is different from document.body and does is not placed at (0,0), the created color picker popup will be placed in an offset from where its supposed to be, the same offset the appendTo element is from (0,0)
The fix is (jsColor.js)
line 109: add
var atrect = (options.appendTo || document.body).getBoundingClientRect();
line 112:
'left:' + (position.left + options.margin.left - atrect.left) + 'px;' +
'top:' + (position.top + +input.offsetHeight + options.margin.top - atrect.top) + 'px;';