simpler way lol

This commit is contained in:
Freeplay 2023-06-10 16:49:07 -04:00
parent 27a935a2ff
commit 5893b4c117
2 changed files with 11 additions and 4 deletions

View File

@ -381,9 +381,12 @@ const onContextmenu = (ev: MouseEvent) => {
}; };
const attachSticky = (el: any) => { const attachSticky = (el: any) => {
const sticky = new StickySidebar(widgetsEl); let lastScrollTop = 0;
addEventListener("scroll", () => { addEventListener("scroll", (ev) => {
sticky.calc(window.scrollY) requestAnimationFrame(() => {
widgetsEl.scrollTop += window.scrollY - lastScrollTop;
lastScrollTop = window.scrollY <= 0 ? 0 : window.scrollY;
})
}, { passive: true }); }, { passive: true });
}; };
@ -557,8 +560,13 @@ console.log(mainRouter.currentRoute.value.name);
} }
> .widgets-container { > .widgets-container {
position: sticky;
top: 0;
max-height: 100vh;
overflow-y: auto;
padding: 0 var(--margin); padding: 0 var(--margin);
width: 300px; width: 300px;
min-width: max-content;
box-sizing: content-box; box-sizing: content-box;
@media (max-width: $widgets-hide-threshold) { @media (max-width: $widgets-hide-threshold) {

View File

@ -84,7 +84,6 @@ function updateWidgets(widgets) {
<style lang="scss" scoped> <style lang="scss" scoped>
.widgets { .widgets {
position: sticky;
height: min-content; height: min-content;
min-height: 100vh; min-height: 100vh;
padding: var(--margin) 0; padding: var(--margin) 0;