bootstrap-autocomplete
bootstrap-autocomplete copied to clipboard
list position not sticking under input when page length changes
a way to update position of the select menu.. i add stuff dynamically and this increases page size length, the dropdown menu seems not to stick under the input when this happens
Hi @bmatusiak I can look into exposing a method to reposition the dropdown. Can you create a test environment on jsfiddle (or similar) to match your usecase?
https://jsfiddle.net/yL0782d4/
@xcash got that fiddle for ya
i also noticed another bug, in this fiddle, add a line, and press "TAB" it re-selects last selected, this operations add 2x of the same thing
https://gist.github.com/bmatusiak/f8dc536ad5566db4d3c71390857a7109/revisions
i copied some logic from v4 class and it seems to work for me,, #note in v4 that the code i copied is disabled
and as for re-selecting on tab,, i turned off autoselect, but i like the autoselect feature in some cases,
so this other gist is another possible fix,
https://gist.github.com/bmatusiak/c857f66601599b947fa86e988a014ccb/revisions
You should be able to resolve this by putting a wrapper div with position:relative; around the form of the autocomplete field. Then, add position:absolute; to .bootstrap-autocomplete.dropdown-menu
Is this still a bug?
workaround (BS4):
.on("autocomplete.dd.shown", function (evt) {
const element = $(evt.target);
const top = element.position().top + element.outerHeight();
element.next().css("top", top);
})