首页 > Web开发 > 详细

jQuery-弹幕

时间:2018-07-03 22:05:20      阅读:224      评论:0      收藏:0      [点我收藏+]

该方法可能有bug,毕竟简单粗暴

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
<style>
* {
margin: 0;
padding: 0;
}

.video {
margin: 50px auto 10px auto;
width: 500px;
height: 500px;
border: 1px solid pink;
}

.btn {
width: 40px;
height: 25px;
background: #26d4bd;
color: #fff;
border: none;
outline: none;
}
.active{
width: 65px;
background: red;
}
.box{
margin: 0px auto;
width: 500px;
height: 500px;
}
</style>
</head>

<body>
<div class="video" id="video"></div>
<div class="box">
<input type="text" id="text"/> <button type="button" id="btn" class="btn">发送</button>
<button type="button" id="clear" class="btn active">清空弹幕</button>
</div>

<script>
$("#btn").click(function(){
$("#video").append(‘<marquee behavior="scroll" direction="left" loop="1" scrollamount="100" scrolldelay="500">‘+$("#text").val()+‘</marquee>‘)
$("#text").val("")
})

$("#clear").click(function(){
$("#video").empty()
})
</script>
</body>

</html>

jQuery-弹幕

原文:https://www.cnblogs.com/web-zyf/p/9260808.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!