效果展示区
效果展示区
CSS代码部分
<style>
body{
margin:0;/*外边距*/
background-image:url("3.jpg");/*背景图片*/
background-size:cover;/*等比例覆盖*/
}
.snowfall-flakes{
position: relative;/*相对定位*/
width:20px;
height:20px;
margin:5px auto;/*上下外边距 左右外边距*/
}
.snowfall-flakes:before,
.snowfall-flakes:after{/*伪元素*/
content: "";/*插入内容*/
position: absolute;/*绝对定位*/
width:10px;
height:15px;
background-color:red;/*红色小心心*/
border-radius: 5px 5px 0 0;/*圆角属性*/
}
.snowfall-flakes:before{
transform:rotate(-45deg);/*向左旋转45度角*/
}
.snowfall-flakes:after{
transform:translateX(3.6px) rotate(45deg);/*右移30像素 向右旋转45度角*/
}
</style>
HTML/JS代码部分
<div class="snowfall-flakes"></div>
<script src="jquery-1.2.6.min.js"></script>
<script src="snowfall.jquery.js"></script>
<script >/*JS代码实现爱心飘落*/
$(document).snowfall({flakeCount:100,maxSpeed:10});
</script>
You do
1.更换背景图片
2.需要引入插件
如果有需要qq(2937155714)联系我
不添加插件的情况下,可以做出爱心效果
添加插件可以实现爱心飘落
如果喜欢点赞支持谢谢