달력 위치 수정

master
mjkhan21 5 months ago
parent daabf18dfb
commit 92c3f11c08

@ -687,10 +687,15 @@
return this; return this;
var calendarWidth = this.picker.outerWidth(), var calendarWidth = this.picker.outerWidth(),
calendarHeight = this.picker.outerHeight(), calendarHeight = this.picker.outerHeight(),
inputHeight = this.inputField.innerHeight(),
visualPadding = 10, visualPadding = 10,
container = $(this.o.container), container = $(this.o.container),
windowWidth = container.width(), windowWidth = container.width(),
windowHeight = container.height(),
scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(), scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),
scrollHeight = container[0].scrollHeight,
clientHeight = this.o.container === 'body' ? window.innerHeight : container[0].clientHeight,
scrollMoveMax = scrollHeight - clientHeight,
appendOffset = container.offset(); appendOffset = container.offset();
var parentsZindex = [0]; var parentsZindex = [0];
@ -744,10 +749,22 @@
// auto y orientation is best-situation: top or bottom, no fudging, // auto y orientation is best-situation: top or bottom, no fudging,
// decision based on which shows more of the calendar // decision based on which shows more of the calendar
var yorient = this.o.orientation.y, var yorient = this.o.orientation.y,
top_overflow; bottom_overflow, top_overflow;
if (yorient === 'auto'){ if (yorient === 'auto'){
bottom_overflow = (windowHeight-top) - inputHeight - calendarHeight + (scrollMoveMax-scrollTop);
top_overflow = -scrollTop + top - calendarHeight; top_overflow = -scrollTop + top - calendarHeight;
yorient = top_overflow < 0 ? 'bottom' : 'top';
yorient = 'bottom';
if(bottom_overflow < 0){
yorient = 'top';
if(top_overflow < 0){
yorient = 'bottom';
}
}
} }
this.picker.addClass('datepicker-orient-' + yorient); this.picker.addClass('datepicker-orient-' + yorient);

Loading…
Cancel
Save