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
javascriptscript that will add effect when mouse clicking. In this tutorial I will use aheart.jsfile. - Store your
heart.jsfile somewhere undersourcedirectory.- in this case we will create a
javascriptfolder undersourceand put theheart.jsinside. - full path will be
/javascript/heart.js.
- in this case we will create a
- create a
_datafolder under yoursource. Visit link to understand how it works. - create a
head.njkfile. - from
_config.next.ymlfile, 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.