1
0
mirror of https://github.com/minio/docs.git synced 2025-08-06 14:42:56 +03:00

Fix anchor scrolling issue on Webkit browsers (#669)

This commit is contained in:
Rushan
2022-12-08 22:40:54 +04:00
committed by GitHub
parent f7b3b1c621
commit d3e40ff232
2 changed files with 13 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
})(); })();
// -------------------------------------------------- // --------------------------------------------------
// Dynamic sidebar scroll on read-mode. // Dynamic sidebar scroll on non read-mode.
// This'll allow the sidebar to display all content, // This'll allow the sidebar to display all content,
// without scrolling the body. // without scrolling the body.
// -------------------------------------------------- // --------------------------------------------------
@@ -54,12 +54,21 @@ window.addEventListener("DOMContentLoaded", (event) => {
// Make the sidebar is scrollable. // Make the sidebar is scrollable.
sidebarEl.classList.remove("inactive"); sidebarEl.classList.remove("inactive");
// Scroll to hash
var hash = window.location.hash;
if (hash) {
var el = document.querySelector(hash);
if (el) {
el.scrollIntoView();
}
}
}, 100); }, 100);
document.addEventListener("scroll", (e) => { document.addEventListener("scroll", (e) => {
setSidebarHeight(); setSidebarHeight();
}); });
// -------------------------------------------------- // --------------------------------------------------
// Read mode // Read mode
// -------------------------------------------------- // --------------------------------------------------

View File

@@ -48,6 +48,8 @@
.content { .content {
@include breakpoint-min(breakpoints(lg)) { @include breakpoint-min(breakpoints(lg)) {
overflow: auto; overflow: auto;
scroll-behavior: smooth;
scroll-padding: 2rem;
} }
& > .container { & > .container {