日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

弹幕效果

發(fā)布時(shí)間:2023/12/9 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 弹幕效果 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>彈幕效果</title>
<script src="../../jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style type="text/css">
html,
body {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
font-family: "微軟雅黑";
font-size: 62.5%;
background: #ccc;
}

.boxDom {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}

.idDom {
width: 100%;
height: 60px;
background: #666;
position: fixed;
bottom: 0px;
}

.content {
display: inline-block;
width: 430px;
height: 40px;
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
margin: auto;
}

.title {
display: inline;
font-size: 4em;
vertical-align: bottom;
color: #fff;
}

.text {
border: none;
width: 300px;
height: 30px;
border-radius: 5px;
font-size: 2.4em;
}

.btn {
width: 60px;
height: 30px;
background: #f90000;
border: none;
color: #fff;
font-size: 2.4em;
}

.string {
width: 300px;
height: 40px;
position: absolute;
overflow: hidden;
color: #000;
font-size: 4em;
line-height: 1.5em;
cursor: pointer;
white-space: nowrap;
}
</style>

<body>
<div class="boxDom" id="boxDom">
<div class="idDom" id="idDom">
<div class="content">
<p class="title">吐槽:</p>
<input type="text" class="text" id="text" />
<button type="button" class="btn" id="btn">發(fā)射</button>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
var pageW = parseInt($(document).width());
var pageH = parseInt($(document).height());
var boxDom = $("#boxDom");
var btnDom = $("#btn");
var Top, Right;
var width;
width = pageW;
var colorArr = ["#cfaf12", "#12af01", "#981234", "#adefsa", "#db6be4", "#f5264c", "#d34a74"];
btnDom.bind("click", auto);
document.onkeydown = function(e) {
if(e.keyCode == 13) {
auto();
}
}

function auto() {
var creSpan = $("<span class='string'></span>");
var text = $("#text").val();
creSpan.text(text);
$("#text").val("");
Top = parseInt(pageH * (Math.random()));
var num = parseInt(colorArr.length * (Math.random()));
if(Top > pageH - 90) {
Top = pageH - 90;
}
creSpan.css({
"top": Top,
"right": -300,
"color": getRandomColor()
});
boxDom.append(creSpan);
var spanDom = $("#boxDom>span:last-child");
spanDom.stop().animate({
"right": pageW + 300
}, 10000, "linear", function() {
$(this).remove();
});
}

function getRandomColor() {
return '#' + (function(h) {
console.log(h)
return new Array(7 - h.length).join("0") + h
})((Math.random() * 0x1000000 << 0).toString(16));
}
});
</script>
</body>

</html>

轉(zhuǎn)載于:https://www.cnblogs.com/icey618/p/7686716.html

總結(jié)

以上是生活随笔為你收集整理的弹幕效果的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。