Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save antoiba86/68b5a61a71022d939ba7a956d963ae65 to your computer and use it in GitHub Desktop.
Save antoiba86/68b5a61a71022d939ba7a956d963ae65 to your computer and use it in GitHub Desktop.
const checkOffset = $.datepicker._checkOffset;
$.extend($.datepicker, {
_checkOffset: function(inst, offset, isFixed) {
if(!isFixed) {
return checkOffset.apply(this, arguments);
}
let isRTL = this._get(inst, "isRTL");
let obj = inst.input[0];
// copied from Datepicker._findPos (node_modules/jquery-ui/datepicker.js)
while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
obj = obj[isRTL ? "previousSibling" : "nextSibling"];
}
let rect = obj.getBoundingClientRect();
return {
top: rect.top+rect.height,
left: rect.left
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment