ele
element if it's not visible in its scrollable container:const scrollToBeVisible = function (ele, container) {const eleTop = ele.offsetTop;const eleBottom = eleTop + ele.clientHeight;const containerTop = container.scrollTop;const containerBottom = containerTop + container.clientHeight;if (eleTop < containerTop) {// Scroll to the top of containercontainer.scrollTop -= containerTop - eleTop;} else if (eleBottom > containerBottom) {// Scroll to the bottom of containercontainer.scrollTop += eleBottom - containerBottom;}};