src/ContextualPopup/ContextualPopup.js
function () {
		this.resetPositioning();
		this.addClass('vertical');

		var clientRect = this.getBoundingRect(this.node);
		var innerHeight = this.getViewHeight();

		if (this.floating){
			if (this.activatorOffset.top < (innerHeight / 2)) {
				this.applyPosition({top: this.activatorOffset.top + this.activatorOffset.height, bottom: 'auto'});
				this.addClass('below');
			} else {
				this.applyPosition({top: this.activatorOffset.top - clientRect.height, bottom: 'auto'});
				this.addClass('above');
			}
		} else {
			//if the popup's bottom goes off the screen then put it on the top of the invoking control
			if ((clientRect.top + clientRect.height > innerHeight) && ((innerHeight - clientRect.bottom) < (clientRect.top - clientRect.height))){
				this.addClass('above');
			} else {
				this.addClass('below');
			}
		}

		//if moving the popup above or below the activator puts it past the edge of the screen then vertical doesn't work
		clientRect = this.getBoundingRect(this.node);
		if ((clientRect.top + clientRect.height) > innerHeight || clientRect.top < 0){
			return false;
		}

		return true;
	}
function () {
		this.resetPositioning();
		this.addClass('vertical');

		var clientRect = this.getBoundingRect(this.node);
		var innerHeight = this.getViewHeight();

		if (this.floating){
			if (this.activatorOffset.top < (innerHeight / 2)) {
				this.applyPosition({top: this.activatorOffset.top + this.activatorOffset.height, bottom: 'auto'});
				this.addClass('below');
			} else {
				this.applyPosition({top: this.activatorOffset.top - clientRect.height, bottom: 'auto'});
				this.addClass('above');
			}
		} else {
			//if the popup's bottom goes off the screen then put it on the top of the invoking control
			if ((clientRect.top + clientRect.height > innerHeight) && ((innerHeight - clientRect.bottom) < (clientRect.top - clientRect.height))){
				this.addClass('above');
			} else {
				this.addClass('below');
			}
		}

		//if moving the popup above or below the activator puts it past the edge of the screen then vertical doesn't work
		clientRect = this.getBoundingRect(this.node);
		if ((clientRect.top + clientRect.height) > innerHeight || clientRect.top < 0){
			return false;
		}

		return true;
	}
function ( ) { this . resetPositioning ( ) ; this . addClass ( 'vertical' ) ; var clientRect = this . getBoundingRect ( this . node ) ; var innerHeight = this . getViewHeight ( ) ; if ( this . floating ) { if ( this . activatorOffset . top < ( innerHeight / 2 ) ) { this . applyPosition ( { top : this . activatorOffset . top + this . activatorOffset . height , bottom : 'auto' } ) ; this . addClass ( 'below' ) ; } else { this . applyPosition ( { top : this . activatorOffset . top - clientRect . height , bottom : 'auto' } ) ; this . addClass ( 'above' ) ; } } else { //if the popup's bottom goes off the screen then put it on the top of the invoking control if ( ( clientRect . top + clientRect . height > innerHeight ) && ( ( innerHeight - clientRect . bottom ) < ( clientRect . top - clientRect . height ) ) ) { this . addClass ( 'above' ) ; } else { this . addClass ( 'below' ) ; } } //if moving the popup above or below the activator puts it past the edge of the screen then vertical doesn't work clientRect = this . getBoundingRect ( this . node ) ; if ( ( clientRect . top + clientRect . height ) > innerHeight || clientRect . top < 0 ) { return false ; } return true ; }
Moves the popup below or above the activator and verifies that it fits onscreen.

@return {Boolean} `true` if vertical positioning can be used; otherwise, `false`.
@private
Moves the popup below or above the activator and verifies that it fits onscreen .