jquery-src/jquery.calendars.picker.js
function(inst) {
			var base = (inst.elem.is(':hidden') && inst.trigger ? inst.trigger : inst.elem);
			var offset = base.offset();
			var browserWidth = $(window).width();
			var browserHeight = $(window).height();
			if (browserWidth === 0) {
				return offset;
			}
			var isFixed = false;
			$(inst.elem).parents().each(function() {
				isFixed |= $(this).css('position') === 'fixed';
				return !isFixed;
			});
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
			var above = offset.top - (isFixed ? scrollY : 0) - inst.div.outerHeight();
			var below = offset.top - (isFixed ? scrollY : 0) + base.outerHeight();
			var alignL = offset.left - (isFixed ? scrollX : 0);
			var alignR = offset.left - (isFixed ? scrollX : 0) + base.outerWidth() - inst.div.outerWidth();
			var tooWide = (offset.left - scrollX + inst.div.outerWidth()) > browserWidth;
			var tooHigh = (offset.top - scrollY + inst.elem.outerHeight() +
				inst.div.outerHeight()) > browserHeight;
			inst.div.css('position', isFixed ? 'fixed' : 'absolute');
			var alignment = inst.options.alignment;
			if (alignment === 'topLeft') {
				offset = {left: alignL, top: above};
			}
			else if (alignment === 'topRight') {
				offset = {left: alignR, top: above};
			}
			else if (alignment === 'bottomLeft') {
				offset = {left: alignL, top: below};
			}
			else if (alignment === 'bottomRight') {
				offset = {left: alignR, top: below};
			}
			else if (alignment === 'top') {
				offset = {left: (inst.options.isRTL || tooWide ? alignR : alignL), top: above};
			}
			else { // bottom
				offset = {left: (inst.options.isRTL || tooWide ? alignR : alignL),
					top: (tooHigh ? above : below)};
			}
			offset.left = Math.max((isFixed ? 0 : scrollX), offset.left);
			offset.top = Math.max((isFixed ? 0 : scrollY), offset.top);
			return offset;
		}
function(inst) {
			var base = (inst.elem.is(':hidden') && inst.trigger ? inst.trigger : inst.elem);
			var offset = base.offset();
			var browserWidth = $(window).width();
			var browserHeight = $(window).height();
			if (browserWidth === 0) {
				return offset;
			}
			var isFixed = false;
			$(inst.elem).parents().each(function() {
				isFixed |= $(this).css('position') === 'fixed';
				return !isFixed;
			});
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
			var above = offset.top - (isFixed ? scrollY : 0) - inst.div.outerHeight();
			var below = offset.top - (isFixed ? scrollY : 0) + base.outerHeight();
			var alignL = offset.left - (isFixed ? scrollX : 0);
			var alignR = offset.left - (isFixed ? scrollX : 0) + base.outerWidth() - inst.div.outerWidth();
			var tooWide = (offset.left - scrollX + inst.div.outerWidth()) > browserWidth;
			var tooHigh = (offset.top - scrollY + inst.elem.outerHeight() +
				inst.div.outerHeight()) > browserHeight;
			inst.div.css('position', isFixed ? 'fixed' : 'absolute');
			var alignment = inst.options.alignment;
			if (alignment === 'topLeft') {
				offset = {left: alignL, top: above};
			}
			else if (alignment === 'topRight') {
				offset = {left: alignR, top: above};
			}
			else if (alignment === 'bottomLeft') {
				offset = {left: alignL, top: below};
			}
			else if (alignment === 'bottomRight') {
				offset = {left: alignR, top: below};
			}
			else if (alignment === 'top') {
				offset = {left: (inst.options.isRTL || tooWide ? alignR : alignL), top: above};
			}
			else { // bottom
				offset = {left: (inst.options.isRTL || tooWide ? alignR : alignL),
					top: (tooHigh ? above : below)};
			}
			offset.left = Math.max((isFixed ? 0 : scrollX), offset.left);
			offset.top = Math.max((isFixed ? 0 : scrollY), offset.top);
			return offset;
		}
function ( inst ) { var base = ( inst . elem . is ( ':hidden' ) && inst . trigger ? inst . trigger : inst . elem ) ; var offset = base . offset ( ) ; var browserWidth = $ ( window ) . width ( ) ; var browserHeight = $ ( window ) . height ( ) ; if ( browserWidth === 0 ) { return offset ; } var isFixed = false ; $ ( inst . elem ) . parents ( ) . each ( function ( ) { isFixed |= $ ( this ) . css ( 'position' ) === 'fixed' ; return ! isFixed ; } ) ; var scrollX = document . documentElement . scrollLeft || document . body . scrollLeft ; var scrollY = document . documentElement . scrollTop || document . body . scrollTop ; var above = offset . top - ( isFixed ? scrollY : 0 ) - inst . div . outerHeight ( ) ; var below = offset . top - ( isFixed ? scrollY : 0 ) + base . outerHeight ( ) ; var alignL = offset . left - ( isFixed ? scrollX : 0 ) ; var alignR = offset . left - ( isFixed ? scrollX : 0 ) + base . outerWidth ( ) - inst . div . outerWidth ( ) ; var tooWide = ( offset . left - scrollX + inst . div . outerWidth ( ) ) > browserWidth ; var tooHigh = ( offset . top - scrollY + inst . elem . outerHeight ( ) + inst . div . outerHeight ( ) ) > browserHeight ; inst . div . css ( 'position' , isFixed ? 'fixed' : 'absolute' ) ; var alignment = inst . options . alignment ; if ( alignment === 'topLeft' ) { offset = { left : alignL , top : above } ; } else if ( alignment === 'topRight' ) { offset = { left : alignR , top : above } ; } else if ( alignment === 'bottomLeft' ) { offset = { left : alignL , top : below } ; } else if ( alignment === 'bottomRight' ) { offset = { left : alignR , top : below } ; } else if ( alignment === 'top' ) { offset = { left : ( inst . options . isRTL || tooWide ? alignR : alignL ) , top : above } ; } else { // bottom offset = { left : ( inst . options . isRTL || tooWide ? alignR : alignL ) , top : ( tooHigh ? above : below ) } ; } offset . left = Math . max ( ( isFixed ? 0 : scrollX ) , offset . left ) ; offset . top = Math . max ( ( isFixed ? 0 : scrollY ) , offset . top ) ; return offset ; }
Check positioning to remain on the screen.
@memberof CalendarsPicker
@private
@param inst {object} The current instance settings.
@return {object} The updated offset for the datepicker.
Check positioning to remain on the screen .