效果图:
首先引入需要的文件,parallax依赖于jQuery,parallax下载地址https://cdn.bootcss.com/parallax/2.1.3/jquery.parallax.js,
使用时可以参考此处的文档https://blog.csdn.net/qq_26383604/article/details/72637068
<script src="js/jquery.3.3.1.js" type="text/javascript"></script>
<script src="js/jquery.parallax.js" type="text/javascript"></script>
css部分:
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
.layer{
/*position: absolute; */
}