添加静态背景
- 打开博客根目录/themes/next/source/css/_custom/custom.styl文件,编辑如下:
1 | // Custom styles. |
- 将背景图命名为background.png并放入主题根目录/images下
添加动态背景
_layout.swig
找到themes\next\layout\_layout.swig
文件,添加内容:
在<body>
里添加:
1 | <div class="bg_content"> |
仍是该文件,在末尾添加:
1 | <script type="text/javascript" src="/js/src/dynamic_bg.js"></script> |
dynamic_bg.js
在themes\next\source\js\src
中新建文件dynamic_bg.js
,代码链接中可见:dynamic_bg.js
custom.styl
在themes\next\source\css\_custom\custom.styl
文件末尾添加内容:1
2
3
4
5
6
7.bg_content {
position: fixed;
top: 0;
z-index: -1;
width: 100%;
height: 100%;
}