<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>卷轴</title>
<script>
var box;
window.onload=function(){
box=document.getElementById("box");
//box.scrollTop=30;//scrollTop
window.setInterval(scroll,10);//排成 每0.05秒自动加1
};
function scroll(){
box.scrollTop++;
};
</script>
<style type="text/css">
.box{
border:1px solid #000;width:200px;height:80px;
overflow:auto;
overflow:hidden;//隐藏卷轴
}
</style>
</head>
<body>
<div id="box" class="box">
<div>this is line 1</div>
<div>this is line 2</div>
<div>this is line 3</div>
<div>this is line 4</div>
<div>this is line 5</div>
<div>this is line 6</div>
<div>this is line 7</div>
<div>this is line 8</div>
</div>
</body>
</html>
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme