请帮助一下如何使用按钮和隐藏的滚动条上下滚动内容。在我的示例代码下面。
<!DOCTYPE html>
<html>
<head>
<button onclick="scrollWin(0, 50)">Scroll down</button>
单击按钮之一(多次)以滚动文档窗口。
<p>Look at each scrollbar to see the effect.</p>
<p>Click one of the buttons (multiple times) to scroll the document window.</p>
<p>Look at each scrollbar to see the effect.</p>
<button onclick="scrollWin(0, -50)">Scroll up</button><br><br>
<script>
function scrollWin(x, y) {
window.scrollBy(x, y);
}
</script>
</body>
</html>
<style>
button {
border: 0;
border-radius: 2px;
width: 100%;
background-color: #efefef;
}
.my-custom-scrollbar {
position: relative;
height: 200px;
overflow: auto;
}
</style>