Skip to content

Commit

Permalink
【修复】文章内标签跳转优化
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ-568 committed Dec 16, 2024
1 parent 65b8349 commit cabac8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html>

<html>
<markdown-html version="1.6.2" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
<markdown-html version="1.6.3" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
license="CC BY-SA 4.0 International"></markdown-html>

<head>
Expand Down Expand Up @@ -479,10 +479,10 @@
darkmode.toggle();
} else if (event.target.closest('.translate-switch')) {
translate.changeLanguage(translate.language.getLocal());
} else if (event.target.closest('.outline a[href]')) {
} else if (event.target.closest('a[href^=#]')) {
// 目录平滑移动
const href = event.target.getAttribute('href');
if (href !== '#' && href.startsWith('#')) {
if (href !== '#') {
event.preventDefault();
const targetElement = document.querySelector(href);
if (targetElement) {
Expand Down
Loading

0 comments on commit cabac8f

Please sign in to comment.