i have a \"ul\" that contains lots of \"li\" (several hundred), the ul has a fixed hight of about 400px and the css property overflow:scroll, each li has the height of 40px
If anyone needs a vanilla JS version, the following is working well for me, the value of 50 is just so that I'm showing the whole item when I'm near the top of the list. You can adjust that.
function updateListSelection(liID) {
var list = document.getElementById("id Tag Of The element"),
targetLi = document.getElementById(liID); // id tag of the - element
list.scrollTop = (targetLi.offsetTop - 50);
};