click-effect-tutorial
Before Start
You can add some clicking effects in your Hexo project.
There are a lots of tutorial that ask you to add files into your themes\layout\*.ejs
files, but I suppose you will only find a .gitkeep
file in the latest version of Hexo.
NOTE: Do note that I am using Hexo + Next theme. So if you are not using Next theme, you might need to make some changes accordingly.
Steps
- prepare a
javascript
script that will add effect when mouse clicking. In this tutorial I will use aheart.js
file. - Store your
heart.js
file somewhere undersource
directory.- in this case we will create a
javascript
folder undersource
and put theheart.js
inside. - full path will be
/javascript/heart.js
.
- in this case we will create a
- create a
_data
folder under yoursource
. Visit link to understand how it works. - create a
head.njk
file. - from
_config.next.yml
file, find thecustom_file_path:
and uncomment the head section like this:
1 | custom_file_path: |
- In
head.njk
, we will insert code below:
1 | <script type="text/javascript" src="/javascript/heart.js"></script> |
- That’s all! Enjoy!
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.