ahonn / hexo-theme-even

:rocket: A super concise theme for Hexo
https://ahonn.github.io/hexo-theme-even/
MIT License
1.36k stars 213 forks source link

【建议】文章页面TOC目录能否自动伸缩 #248

Closed mapxn closed 2 years ago

mapxn commented 4 years ago

您好,我非常喜爱您的主题,提一个小小的功能建议 在较长的文章页面上下滚动鼠标滚轮时,能否自动伸缩toc,只展开显示当前信息,其他的进去。 理想情况 https://jdhao.github.io/2018/10/10/hexo_to_hugo/ 实际情况 https://wfk007.github.io/2018/05/08/my-first-blog/

XieJiSS commented 4 years ago

你只需要删除 even/source/js/src/even.js 文件的 Even.prototype.tocFollow 函数,再把这个文件的黄色高亮行加入到你的 even.jsEven.prototype.scrollToc 函数里:

https://github.com/olOwOlo/hugo-theme-even/blob/master/src/js/even.js#L51...L125

再把这个文件的全部:

https://github.com/olOwOlo/hugo-theme-even/blob/master/src/css/_partial/_post/_toc.scss

放到你的服务器的相同位置就好了