Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Menu get truncated if the dropdown at the end of the page #3144

Open
agmak opened this issue Nov 22, 2023 · 0 comments
Open

Menu get truncated if the dropdown at the end of the page #3144

agmak opened this issue Nov 22, 2023 · 0 comments

Comments

@agmak
Copy link

agmak commented Nov 22, 2023

The menu get truncated if the dropdown at the end of the page, I fixed this issue by calling setMenuLocation function from the end of fucntion " AbstractChosen.prototype.winnow_results "

if (!(options != null ? options.skip_highlight : void 0)) {
//calling the function here
setMenuLocation(this.dropdown[0], this.search_choices[0]);
return this.winnow_results_set_highlight();
}

this function will determine if you are at the end of the page and will switch the menu to show at the top of the search choices.

function setMenuLocation(node, chosen) {
var docH = document.documentElement.offsetHeight;
var y = node.getBoundingClientRect().y;
var h = node.offsetHeight;
var pH = chosen.offsetHeight;
var pY = chosen.getBoundingClientRect().y;
if ((pY + h + pH) > (docH - 50)) {
node.style.top = (-h) + "px";
} else if (y != 0 && h != 0) {
node.style.top = "100%"
}
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant