mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 14:34:23 +02:00
Restore position
This commit is contained in:
parent
979d653b1a
commit
90e984e98b
@ -40,7 +40,18 @@ function toggleExplorer(this: HTMLElement) {
|
||||
if (document.querySelector("#mobile-explorer")) {
|
||||
// Disable scrolling one the page when the explorer is opened on mobile
|
||||
const bodySelector = document.querySelector("#quartz-body")
|
||||
if (bodySelector) bodySelector.classList.toggle("lock-scroll")
|
||||
if (bodySelector) {
|
||||
if (!bodySelector.classList.contains("lock-scroll")) {
|
||||
bodySelector.setAttribute("scroll-position", `${window.scrollY}`)
|
||||
bodySelector.classList.toggle("lock-scroll")
|
||||
} else {
|
||||
bodySelector.classList.toggle("lock-scroll")
|
||||
window.scrollTo({
|
||||
top: Number(bodySelector.getAttribute("scroll-position")),
|
||||
behavior: "instant",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,23 @@
|
||||
@use "../../styles/variables.scss" as *;
|
||||
|
||||
// Sticky top bar (stays in place when scrolling down on mobile.
|
||||
@media all and ($mobile) {
|
||||
.page > #quartz-body .sidebar.left:has(.explorer) {
|
||||
box-sizing: border-box;
|
||||
position: sticky;
|
||||
background-color: var(--light);
|
||||
}
|
||||
}
|
||||
|
||||
.explorer {
|
||||
display: flex;
|
||||
|
||||
@media all and ($mobile) {
|
||||
order: -1;
|
||||
height: initial;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
|
||||
button#mobile-explorer {
|
||||
display: none;
|
||||
}
|
||||
@ -220,7 +229,8 @@ li:has(> .folder-outer:not(.open)) > .folder-container > svg {
|
||||
position: absolute;
|
||||
background-color: var(--light);
|
||||
max-width: 100dvw;
|
||||
left: -100dvw;
|
||||
//left: -100dvw;
|
||||
transform: translateX(-100dvw);
|
||||
width: 100%;
|
||||
transition: all 300ms ease-in-out;
|
||||
overflow: hidden;
|
||||
@ -231,7 +241,7 @@ li:has(> .folder-outer:not(.open)) > .folder-container > svg {
|
||||
visibility: visible;
|
||||
|
||||
&:not(.collapsed) {
|
||||
left: 0;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
ul.overflow {
|
||||
@ -240,7 +250,7 @@ li:has(> .folder-outer:not(.open)) > .folder-container > svg {
|
||||
}
|
||||
|
||||
&.collapsed {
|
||||
left: -100dvw;
|
||||
transform: translateX(-100dvw);
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
@ -284,15 +294,3 @@ html:has(.no-scroll) {
|
||||
overflow: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Lock page scroll on mobile
|
||||
.lock-scroll {
|
||||
position: static;
|
||||
}
|
||||
|
||||
@media all and ($mobile) {
|
||||
.lock-scroll {
|
||||
position: fixed;
|
||||
width: calc(100% - 2rem);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user