PitPik / colorPicker

Advanced javaScript color picker and color conversion / calculation (rgb, hsv, hsl, hex, cmyk, cmy, XYZ, Lab, alpha, WCAG 2.0, ...)
http://www.dematte.at/colorPicker/
MIT License
570 stars 136 forks source link

Update jsColor.js #35

Closed calebroseland closed 8 years ago

calebroseland commented 8 years ago

Hi, I encountered an issue where the offset position was incorrectly calculated, resulting in a misplaced color picker on focus.

-Use getBoundingClientRect instead of element offset to account for absolute positioned input elements.

PitPik commented 8 years ago

Hi @calebroseland , thanks for your participation to colorPicker. The implementations are not good and might be buggy. As soon as I have time I will redo the JS and the jQuery implementations. I'm a bit sceptic about getBoundingClientRect as it's relative to the viewport (offsetLeft and Top is definitely not correct). There is a function getOrigin on the Class ColorPicker. I changed the implementation including the present function and updated it on GitHub. Maybe check if this is working for you otherwise I will refactor this whole thing earlier ;o) Thanks again Peter

P.S.: Make sure though that appendTo is not set at all or to document.body