mugifly / jquery-simple-datetimepicker

Date & time picker for jQuery, It's simple & clean.
http://mugifly.github.com/jquery-simple-datetimepicker
Other
260 stars 182 forks source link

misplaced when located in nested elements #38

Closed insonifi closed 11 years ago

insonifi commented 11 years ago

If you put picker in element which is positioned arbitrarily on the screen it get's offset of parent and misplaces calendar relative to input + offset of the input.

I tried to fix it and succeeded by changing following line in your code: $picker.parent().css("left", $input.offset().left + "px");

to

$picker.parent().css("left", $input.position().left + "px");

with this it appears right beneath the element no matter where it is located on the screen.

mugifly commented 11 years ago

Thank you insonifi. I apply your code to repository. df42e0261338dacd913c91c8b84f1ce7ad450b6a