使用js、html、css写了一个雪花随机大小、随机速度下落、随机x位置的效果。
雪花的命名有规律:
html:
<div id="box" class="bg"></div>
css:
body {
margin: 0;
}
.bg {
position: absolute;
height: 100%;
width: 100%;
background: url(img/image23.jpg) no-repeat top center;
background-size: cover;
overflow: hidden;
}
.bg img {
position: absolute;
left: 0;
top: 10px;
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease-out;
-ms-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
js:
var oBox = document.getElementById('bo