jQuery 效果999动画 延迟

六眼飞鱼酱① 提交于 2020-03-18 14:40:00

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表白墙</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<style>
body{
margin: 0 auto;
padding: 0px;
background:#000000;
}
.content{
display: inline-block;
width: 350px;
height: 400px;
}
div>div>div {
display: block;
height: 20px;
}
div>div>div>div {
width: 16px;
height: 16px;
display: inline-block;
float: left;
margin: 2px;
}
div>div.content1>div>div.fl {
background-color:#ff0033;
}
div>div.content2>div>div.fl {
background-color:#ff0033;
}
div>div.content3>div>div.fl {
background-color:#ff0033;
}
</style>

</head>
<body>

<div style="width:1100px; margin:100px auto;">
<div class="content content1">
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
</div>
<div class="content content2">
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
</div>
<div class="content content3">
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl" style="margin-left: 222px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl" style="margin-left:262px;"></div>
<div class="fl"></div>
</div>
<div style="margin-left: 20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
<div style="margin-left:20px;">
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
<div class="fl"></div>
</div>
</div>
</div>

 

<script>
$(function() { //var p = animate() [] 声明一个变量
animate();
function animate() { //调用animate()方法
$('div>div>div>div').each(function() { // each()为每个匹配元素 输出嵌套里div里面的内容
$(this).css({ //改变它当前的css样式 相对定位 从上往下显示动画 透明度为0
position: 'relative',
top: '-400px',
opacity: 0
});

var wait = Math.floor((Math.random() * 3000) + 1); //声明一个变量让它随机 random()
$(this).delay(wait).animate({ //delay() 被选元素的所有函数,未运行设置延迟 设置向下 opacity透明度
top: '10px',
opacity: 1
}, 2000, function() {
$(this).delay(wait).animate({
top: '0px',
opacity: 0
}, 1000, function() {
$(this).delay(wait).animate({
top: '0px',
opacity: 1
}, 500);
});
});
});
}
});


</script>
</body>
</html>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!