달력 위치 수정

master
mjkhan21 5 months ago
parent daabf18dfb
commit 92c3f11c08

@ -687,10 +687,15 @@
return this;
var calendarWidth = this.picker.outerWidth(),
calendarHeight = this.picker.outerHeight(),
inputHeight = this.inputField.innerHeight(),
visualPadding = 10,
container = $(this.o.container),
windowWidth = container.width(),
windowHeight = container.height(),
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();
var parentsZindex = [0];
@ -744,10 +749,22 @@
// auto y orientation is best-situation: top or bottom, no fudging,
// decision based on which shows more of the calendar
var yorient = this.o.orientation.y,
top_overflow;
bottom_overflow, top_overflow;
if (yorient === 'auto'){
bottom_overflow = (windowHeight-top) - inputHeight - calendarHeight + (scrollMoveMax-scrollTop);
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);

Loading…
Cancel
Save