html滚动字幕html5css3实现字幕滚动的效果
html5中marquee逐渐被取代,要实现字幕的滚动可以再js中实现:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>html5</title>
<style>
body {
margin: 0px;
font-size: 12px;
color: #938C43;
line-height: 150%;
text-align:center;
}
a:link{color: #9D943A;font-size:12px;}
a:hover{color: #FF3300;font-size:12px;}
a:visited{color: #9D943A;font-size:12px;}
#marqueeBox{background:#f7f7f7;border:1px solid silver;padding:1px;text-align:center;margin:0 auto;}
-->
</style>
</head>
<body>
<h4>滚动新闻</h4>
<script language="JavaScript" type="text/javascript">
var marqueeContent=new Array();
marqueeContent[0]="<a href=xyq.163/news/2006/11/2-2-20061102170913.html target=_blank>⽤快速取回帐号密码</a>";
marqueeContent[1]="<a href=ekey.163/ target=_blank>⽹易将军令官⽅⽹站</a>";
marqueeContent[2]="<a href=xyq.163/download/wallpaper.htm target=_blank>最新壁纸下载</a>";
marqueeContent[3]="<a href=xyq.163/download/around.htm target=_blank>最新屏保下载</a>";
var marqueeInterval=new Array();
var marqueeId=0;
var marqueeDelay=2000;
var marqueeHeight=20;
function initMarquee() {
var str=marqueeContent[0];
document.write('<div id="marqueeBox" οnmοuseοver="clearInterval(marqueeInterval[0])" οnm    marqueeId++;
marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
}
function startMarquee() {
var str=marqueeContent[marqueeId];
marqueeId++;
if(marqueeId>=marqueeContent.length) marqueeId=0;
ElementById("marqueeBox").childNodes.length==1) {
var ateElement('DIV');
nextLine.innerHTML=str;
}
else {
}
clearInterval(marqueeInterval[1]);
marqueeInterval[1]=setInterval("scrollMarquee()",20);
}
function scrollMarquee() {
function scrollMarquee() {
ElementById("marqueeBox").scrollTop%marqueeHeight==(marqueeHeight-1)){    clearInterval(marqueeInterval[1]);
}
}
initMarquee();
</script>
</body>
</html>
也可以⽤css3实现:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>⽆标题⽂档</title>
<style>
@keyframes move
{
0%
{
transform:translateY(0px);
}
50%
{
transform:translateY(-200px);
}
100%
{
transform:translateY(0px);
}
}
.picTab{height:500px;border:2px solid #000; margin:50px auto;overflow:hidden;}
.picTab .topDiv{width:1000px;height:500px; animation:move 5s linear infinite;text-align:center;} .picTab div {margin:5px;color:black;  }
</style>
</head>
<body>
<DIV class="picTab">
<div  class="topDiv">
<div>"控制洗⾐机"</div>
<div>"控制冰箱"</div>
<div>"开启洗⾐机"</div>
<div>"开始洗⾐"</div>
<div>"关闭洗⾐机"</div>
<div>"棉⿇洗"</div>
<div>"洗涤时间设为20分钟"</div>
<div>"漂洗2次"</div>
<div>"脱⽔6分钟"</div>
<div>"冰箱设为速冷模式"</div>
<div>"冷藏室温度设为5度"</div>
<div>"天⽓"</div>
</div>
</DIV>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。