实例 jQuery 如何设置元素的垂直滚动条位置

x
 
<!DOCTYPE html>
<html>
<head>
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("div").scrollTop(100);
  });
});
</script>
</head>
<body>
<div style="border:1px solid black;width:100px;height:150px;overflow:auto">
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.
</div><br>
<button>Set vertical scrollbar position to 100px</button>
</body>
</html>
                    

输出结果