-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(#1932): implement smooth scrolling for anchor navigation across site #1965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Changes from all commits
ee25a7b
736831c
9ce8ec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
* { | ||
box-sizing: border-box; | ||
-webkit-tap-highlight-color: transparent; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
/* handle header offset with scroll-margin */ | ||
h1, h2, h3, h4, h5, h6, | ||
[id] { | ||
scroll-margin-top: 60px; | ||
} | ||
|
||
/* Respect user motion preferences for access */ | ||
@media (prefers-reduced-motion: reduce) { | ||
html { | ||
scroll-behavior: auto; | ||
} | ||
} | ||
|
||
body { | ||
|
@@ -264,11 +278,6 @@ a { | |
padding-top: 40px; | ||
} | ||
|
||
#api-doc *:target, #page-doc *:target { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I support removing this |
||
margin-top: -120px; | ||
padding-top: 120px; | ||
z-index: -1; | ||
} | ||
|
||
/* logo */ | ||
.logo-container a { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,7 +183,6 @@ toggleBtn?.addEventListener("click", (e) => { | |
// Open/Close sub TOC content on click | ||
document.querySelectorAll("#menu > li > a").forEach((link) => { | ||
link.addEventListener("click", function (event) { | ||
event.preventDefault(); // stop navigation to submenu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to stay. I've been testing, and on mobile it doesn’t work correctly, with this line, it works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line stop scrolling to submenu section headings. E.g. Request, Response, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeh on mobile it is very bad experience There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can stop this on small screens by using line 4 menu.js. Let's focus on desktop. It is important for desktop experience. |
||
|
||
// Find the closest parent <li> | ||
const closestLiParent = link.closest("li"); | ||
|
Uh oh!
There was an error while loading. Please reload this page.