javascript - Scrolling inner div on key down and up -


I have created an autocomplete container that shows the first four results and the other is hidden and the internal device The element that can be seen while scrolling is the element which holds all the results.

I have implemented the key when pressing up and down keys to easily navigate the results of navigating users, but with the result the internal div is not scrolling.

How can you scroll the element in which overflow-y: hidden and not the window?

In the example, just press any key inside the input box and use your arrow to move down, you will see that div is not scrolling

You can update your script to find the relative position of the selected element and scroll it out:

  $ ("some input"). ("Keyp", function (a) {$ ("cover"). Show (); if (e.j. == 40) {$ ('. Element: no (last child) .element-hover'). RemoveClass ('element -hover') .next () addClass ('element-hover');} Else if (e.which == 38) {$ ('element: not (: first-child) .element-hover AddClass ('element-hover');} // scroll to element: $ (". Set top (".wrapper_div"). Scrolltop ($ ('. Element-hover: first') .offet () top-$ (".rapper.inner_div"). Height ()); // Then selected Scale from element to element Set the height of Ing}};   



Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -