<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>滚动</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
ul{
height: 400px;
width: 500px;
}
ul li{
list-style: none;
margin: 0 0 0 50px;
height: 40px;
}
#box{
height: 400px;
width:600px;
background: #eee;
overflow: auto;
}
</style>
</head>
<body>
<div id="box" onmouseover="stop()" onmouseout="go()">
<ul id="ul1">
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
</ul>
</div>
<ul id="ul2">
</ul>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
var _setInterval = setInterval(banner,20) ;
var _h = 0 ;
var maxH = $("#box").height();
function banner()
{
if( _h < maxH )
{
$("#box").scrollTop(_h);
console.log(_h);
console.log($("#box").scrollTop());
_h++ ;
}else
{
_h = 0;
}
}
function gundong(){
var st=$("#ul1").scrollTop();
console.log(st);
if (st>h) {
st=0;
}else{
st++;
}
};
function stop(){
clearInterval(t);
}
function go(){
t=setInterval(banner,20);
};
</script>
</html>
<html>
<head>
<meta charset="utf-8">
<title>滚动</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
ul{
height: 400px;
width: 500px;
}
ul li{
list-style: none;
margin: 0 0 0 50px;
height: 40px;
}
#box{
height: 400px;
width:600px;
background: #eee;
overflow: auto;
}
</style>
</head>
<body>
<div id="box" onmouseover="stop()" onmouseout="go()">
<ul id="ul1">
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
<li>燕赵智融科技(北京)有限公司</li>
</ul>
</div>
<ul id="ul2">
</ul>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
var _setInterval = setInterval(banner,20) ;
var _h = 0 ;
var maxH = $("#box").height();
function banner()
{
if( _h < maxH )
{
$("#box").scrollTop(_h);
console.log(_h);
console.log($("#box").scrollTop());
_h++ ;
}else
{
_h = 0;
}
}
function gundong(){
var st=$("#ul1").scrollTop();
console.log(st);
if (st>h) {
st=0;
}else{
st++;
}
};
function stop(){
clearInterval(t);
}
function go(){
t=setInterval(banner,20);
};
</script>
</html>