准备工作

首先必须引入需要的 jquery 文件,网址为 https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js

再引入必要的鱼儿游动的 js 文件,网址为: https://cdn.jsdelivr.net/gh/xiabo2/CDN@latest/fishes.js

将以上两个文件下载并保存到 Hexo博客项目的 themes/butterfly/source/js/ 文件夹中。

编辑主题配置文件

打开 _config.butterfly.yml , 找到 # Inject, 在 bottom 添加以上两个 js 文件的引用即可(也可以不下载而直接引入那两个文件).

1
2
3
4
5
6
7
8
9
10
11
12
# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head:
# - <link rel="stylesheet" href="/xxx.css">
bottom:
- <script src="/js/jquery.min.js"></script>
- <script src="/js/fishes.js"></script>
# - <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
# - <script src="https://cdn.jsdelivr.net/gh/xiabo2/CDN@latest/fishes.js"></script>
# - <script src="xxxx"></script>

参考:https://weilining.github.io/204.html

===END===