if ( offset.left + ( width / 2 ) > $( window ).width() / 2 ) {
                // Midpoint of the trigger is on the right side of the viewport.
                positionCSS = {
                    // Right edge of the dialog aligns with the right edge of the trigger.
                    right: $( window ).width() - ( offset.left + width ),