Ability to toggle flipped state

This commit is contained in:
Josh Johnson 2016-08-02 19:39:24 +01:00
parent 2b85aa6bae
commit 0ce7c574ea
2 changed files with 4 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -36,6 +36,7 @@ export class Choices {
delimiter: ',',
paste: true,
search: true,
flip: true,
regexFilter: null,
placeholder: true,
placeholderValue: null,
@ -318,7 +319,7 @@ export class Choices {
this.dropdown.classList.add(this.config.classNames.activeState);
const dimensions = this.dropdown.getBoundingClientRect();
const shouldFlip = dimensions.top + dimensions.height >= document.body.offsetHeight;
const shouldFlip = this.config.flip ? dimensions.top + dimensions.height >= document.body.offsetHeight : false;
// Whether or not the dropdown should appear above or below input
if(shouldFlip) {