分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

jQuery-弹幕

发布时间:2023-09-06 02:02责任编辑:沈小雨关键词:jQuery

该方法可能有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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved