mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 19:06:16 +01:00
fix(toc): fix inaccurate headerLinkTop calculation that result in activeTocIndex drift.
This commit is contained in:
parent
dd6c0f7907
commit
440051ec80
1 changed files with 2 additions and 2 deletions
|
@ -160,11 +160,11 @@ jQuery(function($) {
|
||||||
|
|
||||||
const HEADERFIX = 120;
|
const HEADERFIX = 120;
|
||||||
const $toclink = $('.toc-link');
|
const $toclink = $('.toc-link');
|
||||||
const $headerlink = $('.headerlink');
|
const $headerDummyLink = $('.post-dummy-target');
|
||||||
const $tocLinkLis = $('.post-toc-content li');
|
const $tocLinkLis = $('.post-toc-content li');
|
||||||
const activeIndex = function () {
|
const activeIndex = function () {
|
||||||
const scrollTop = $(window).scrollTop();
|
const scrollTop = $(window).scrollTop();
|
||||||
const headerlinkTop = $.map($headerlink, function(link) {
|
const headerlinkTop = $.map($headerDummyLink, function(link) {
|
||||||
return $(link).offset().top;
|
return $(link).offset().top;
|
||||||
});
|
});
|
||||||
const searchActiveTocIndex = function(array, target) {
|
const searchActiveTocIndex = function(array, target) {
|
||||||
|
|
Loading…
Reference in a new issue