mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-12-08 05:34:22 +00:00
fix setting position to the sometimes incorrect datetimepicker element position
This commit is contained in:
parent
c05c507177
commit
765127ee80
@ -1915,7 +1915,7 @@
|
|||||||
current_time_index = 0;
|
current_time_index = 0;
|
||||||
|
|
||||||
setPos = function () {
|
setPos = function () {
|
||||||
var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node;
|
var offset = datetimepicker.data('input').offset(), datetimepickerelement = datetimepicker.data('input')[0], top = offset.top + datetimepickerelement.offsetHeight - 1, left = offset.left, position = "absolute", node;
|
||||||
if (datetimepicker.data('input').parent().css('direction') == 'rtl')
|
if (datetimepicker.data('input').parent().css('direction') == 'rtl')
|
||||||
left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
|
left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
|
||||||
if (options.fixed) {
|
if (options.fixed) {
|
||||||
@ -1923,14 +1923,14 @@
|
|||||||
left -= $(window).scrollLeft();
|
left -= $(window).scrollLeft();
|
||||||
position = "fixed";
|
position = "fixed";
|
||||||
} else {
|
} else {
|
||||||
if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) {
|
if (top + datetimepickerelement.offsetHeight > $(window).height() + $(window).scrollTop()) {
|
||||||
top = offset.top - datetimepicker[0].offsetHeight + 1;
|
top = offset.top - datetimepickerelement.offsetHeight + 1;
|
||||||
}
|
}
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
top = 0;
|
top = 0;
|
||||||
}
|
}
|
||||||
if (left + datetimepicker[0].offsetWidth > $(window).width()) {
|
if (left + datetimepickerelement.offsetWidth > $(window).width()) {
|
||||||
left = $(window).width() - datetimepicker[0].offsetWidth;
|
left = $(window).width() - datetimepickerelement.offsetWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user