码迷,mamicode.com
首页 > 其他好文 > 详细

简单的文字滚动效果

时间:2014-07-19 17:32:35      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   cti   html   c   

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
ul li
{

height: 30px;

}
</style>
</head>

<body>
<div id="demo" style="height: 50px; overflow:hidden;border: 1px solid #000;">
<div id="demo1">
<ul>
<li>di yitiao xinwen</li>
<li>di yitiao xinwen</li>

<li>di yitiao xinwen</li>
<li>GGGGGGGGGGGGG</li>
</ul>
</div>
<div id="demo2"></div>
</div>
<script>
var speed = 50
demo2.innerHTML = demo1.innerHTML
function Marquee() {
if (demo2.offsetTop - demo.scrollTop <= 0)
demo.scrollTop -= demo1.offsetHeight
else {
demo.scrollTop++
}
}
var MyMar = setInterval(Marquee, speed)
demo.onmouseover = function () { clearInterval(MyMar) }
demo.onmouseout = function () { MyMar = setInterval(Marquee, speed) }
</script>

</body>
</html>

简单的文字滚动效果,布布扣,bubuko.com

简单的文字滚动效果

标签:style   http   io   cti   html   c   

原文地址:http://www.cnblogs.com/fengpiaoling/p/3853837.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!