Tony He

Tony He

Living an absolutely not meaningless life with totally not unachievable goals.

马上订阅 Tony He RSS 更新: https://www.ouorz.com/feed

用 jQuery 写一个获取文章目录的功能

Tony He
2019年3月5日 23:10
personaltechnologylifeblogs
思路 jQuery 有一个 each() 函数,可以获取每一个对应元素。比如博客主题文章中 .article-index h3 就是我一般喜欢作为标题的元素,于是尝试使用它来做一个文章目录功能。初步的做法是讲每一次 each() 函数获取到的 h3 标题的 offset().top 值存入一个数组,在滑动时从第二个下标...