Select2 Scroll page up / down

Select2 uses events Page Upand Page Downfor the prevention of page scrolling, but I want to be an active list is scrolled by pressing these keys.

The problem is scrolling the list by the correct number of indexes or pixels, if possible. Naively, I call this.moveHighlight(-5);on KEY.PAGE_UPand is similar to KEY.PAGE_DOWN.

What is the correct way to scroll the Select2 dropdown menu one page?

Here is the code that swallows events:

if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
    // prevent the page from scrolling
    killEvent(e);
    return;
}
+5
source share

All Articles