<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery夜晚天空满天星星闪烁动画代码</title>
<script src="js/jquery.min.js"></script>
<style>
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
background: #22313f;
}
#starsBox {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.75);
opacity: .5;
}
#starsBox span {
display: inline-block;
width: auto;
position: absolute;
border-radius: 100%;
transition: 100s linear;
}
p {
position: fixed;
top: 50%;
left: 0;
right: 0;
text-align: center;
transform: translateY(-50%);
font-size: 40px;
font-weight: 900;
color: white;
text-shadow: 0 0 50px black;
text-transform: uppercase;
font-family: 'Roboto','Helvetica','Arial',sans-serif;
letter-spacing: 5px;
}
p > span {
display: block;
font-size: 12px;
color: #bdc3c7;
margin-top: 30px;
font-weight: 100;
text-shadow: 0 0 50px black;
letter-spacing: 3px;
}
p > span > a {
font-weight: 700;
text-decoration: none;
color: #d64541;
padding-bottom: 2px;
border-bottom: 0px solid #d64541;
transition: 0.5s;
}
p > span > a:hover {
padding-bottom: 5px;
border-bottom: 2px solid #d64541;
}
</style>
</head>
<body>
<div id="starsBox"></div>
<p>布满星星的天空</p>
<script type="text/javascript">
var cols = ['#f5d76e','#f7ca18','#f4d03f','#ececec','#ecf0f1','#a2ded0'];
var stars = 250;
for (var i = 0; i <= stars; i++) {
var size = Math.random()*3;
var color = cols[parseInt(Math.random()*4)];
$('#starsBox').prepend('<span style=" width: ' + size + 'px; height: ' + size + 'px; top: ' + Math.random()*100 + '%; left: ' + Math.random()*100 + '%; background: ' + color + '; box-shadow: 0 0 '+ Math.random()*10 +'px' + color + ';"></span>') ;
};
setTimeout(function(){
$('#starsBox span').each(function(){
$(this).css('top', Math.random()*100 + '%').css('left', Math.random()*100 + '%');
});
}, 1);
setInterval(function(){
$('#starsBox span').each(function(){
$(this).css('top', Math.random()*100 + '%').css('left', Math.random()*100 + '%');
});
}, 100000);
</script>
</body>
</html>
Jquery满天星闪烁动画代码
需积分: 44 104 浏览量
2018-01-23
11:03:28
上传
评论 1
收藏 33KB ZIP 举报
liumce
- 粉丝: 228
- 资源: 12
最新资源
- HCIP-Datacom笔记 (1).pdf
- yolov5,SSD 可能使用到的一些代码
- bbbbbbbbbbbbbbbbbb
- 安卓逆向学习笔记之Frida Stalker 还原OLLVM AES.docx
- 安卓逆向学习笔记之unicorn来trace还原OLLVM Base64.docx
- 最新版本私钥助记词碰撞器大富豪使用python进行制作通过接口的方式进行验证支持多币种多链多网络一分钟万次验证高出货率
- 介绍离散性制造行业的MES系统流程
- Arduino IDE压缩包版本,2024年4月26日,最新版本
- 基于IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chines微调的中文文本摘要任务源码+数据集
- 自动驾驶-状态估计和定位之直方图滤波(Histogram+Filter)定位应用和源码.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈