Skip to content

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

Open

Description

@agmak

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%"
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions