Skip to content

Commit

Permalink
page/landing
Browse files Browse the repository at this point in the history
  • Loading branch information
zhzLuke96 committed May 10, 2024
1 parent 9b2af31 commit 3fd29b3
Show file tree
Hide file tree
Showing 2 changed files with 335 additions and 150 deletions.
25 changes: 25 additions & 0 deletions pages/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
max-width: 768px;
height: auto;
}

@media (max-width: 768px) {
.markdown-body img {
max-width: 100%;
}
}
</style>
</head>
<body class="sc-scrollbar">
Expand Down Expand Up @@ -355,6 +361,24 @@
});
}

redirect_a_href() {
const anchors = Array.from(this.$root.querySelectorAll("a"));
anchors.forEach((a) => {
const href = a.getAttribute("href");
if (href && href.startsWith("#")) {
// a.removeAttribute("href");
a.href = "";
a.addEventListener("click", (e) => {
e.preventDefault();
const target = document.querySelector(href);
target.scrollIntoView({
behavior: "smooth",
});
});
}
});
}

/**
* @param {string} md_url
**/
Expand All @@ -363,6 +387,7 @@
this.parse();
this.mount();
this.redirect_image_src();
this.redirect_a_href();
}

async setup() {
Expand Down
Loading

0 comments on commit 3fd29b3

Please sign in to comment.