<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style>
div{
border:1px solid black;
line-height: 2;
margin-bottom:10px;
width: 120px;
height:100px;
overflow-y: scroll;
}
</style>
</head>
<body>
<h1>jQuery scrollTop() Method</h1>
<div>
Here is some dummy text to make the div scrollable. Please don't forget to scroll up and down.
</div>
<button>Move y-pos to litte</button>
<script>
$(document).ready(function(){
$("button").click(function(){
var myPixel = $("div").scrollTop() + 40;
$("div").scrollTop(myPixel);
});
});
</script> </body>
</html>