<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.con{
width: 50%;
margin: 0 auto;
height: 400px;
overflow: hidden;
position: relative;
}
li{
list-style: none;
border: 1px solid deeppink;
height: 26px;
}
.info1{
margin: 10px auto;
}
</style>
</head>
<body>
<div id="con" class="con">
<ul class="info1">
<li>
<span>李**1</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**2</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**3</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**4</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**5</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**6</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**7</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**8</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**9</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**10</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**11</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**12</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**13</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**14</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
</ul>
<ul class="info2"></ul>
</div>
<script>
var timer;
var con=document.getElementById("con");
var ul=document.getElementsByClassName("info1").item(0);
var ul2=document.getElementsByClassName("info2").item(0);
ul2.innerHTML=ul.innerHTML;
function scllo(){
if (ul.offsetHeight <= con.scrollTop) { //392==392
// con.scrollTop -= ul2.offsetHeight; //con.scrollTop=0
con.scrollTop = 0;
}
else {
con.scrollTop++;
console.log(con.scrollTop);
}
}
timer=setInterval(scllo,40);
con.οnmοuseοut= function () {
timer=setInterval(scllo,40);
};
//鼠标移上去停止
con.οnmοusemοve= function () {
clearInterval(timer);
};
</script>
</body>
</html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.con{
width: 50%;
margin: 0 auto;
height: 400px;
overflow: hidden;
position: relative;
}
li{
list-style: none;
border: 1px solid deeppink;
height: 26px;
}
.info1{
margin: 10px auto;
}
</style>
</head>
<body>
<div id="con" class="con">
<ul class="info1">
<li>
<span>李**1</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**2</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**3</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**4</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**5</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**6</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**7</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**8</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**9</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**10</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**11</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**12</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**13</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
<li>
<span>李**14</span>
<span>山西职业技术学院</span>
<span>应用电子</span>
<span>合荣欣业</span>
<span>8000</span>
<span>北京</span>
<span>2015-08-13</span>
</li>
</ul>
<ul class="info2"></ul>
</div>
<script>
var timer;
var con=document.getElementById("con");
var ul=document.getElementsByClassName("info1").item(0);
var ul2=document.getElementsByClassName("info2").item(0);
ul2.innerHTML=ul.innerHTML;
function scllo(){
if (ul.offsetHeight <= con.scrollTop) { //392==392
// con.scrollTop -= ul2.offsetHeight; //con.scrollTop=0
con.scrollTop = 0;
}
else {
con.scrollTop++;
console.log(con.scrollTop);
}
}
timer=setInterval(scllo,40);
con.οnmοuseοut= function () {
timer=setInterval(scllo,40);
};
//鼠标移上去停止
con.οnmοusemοve= function () {
clearInterval(timer);
};
</script>
</body>
</html>