Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

fix back to top scroll

Smaug6739d3ebe3b2e83b
diff --git a/frontend/App.vue b/frontend/App.vue
index 275fee1b..a04ddda9 100644
--- a/frontend/App.vue
+++ b/frontend/App.vue
@@ -1,6 +1,6 @@
<template>
<div>
- <NuxtPage id="app-scroll" />
+ <NuxtPage />
<div id="backdrop"></div>
<Notification />
<ClientOnly>
diff --git a/frontend/components/BackToTop.vue b/frontend/components/BackToTop.vue
index fd937385..276efed0 100644
--- a/frontend/components/BackToTop.vue
+++ b/frontend/components/BackToTop.vue
@@ -5,17 +5,16 @@
<script setup lang="ts">
const scrollTop = ref(0);
-const scroll_element = document.getElementById('app-scroll')!;
-const getScrollTop = () => scroll_element.scrollTop || 0;
-const scrollToTop = () => scroll_element.scrollTo({ top: 0, behavior: 'smooth' });
+const getScrollTop = () => window.scrollY || 0;
+const scrollToTop = () => window.scrollTo({ top: 0, behavior: 'smooth' });
const show = computed(() => scrollTop.value > 300);
const onScroll = () => scrollTop.value = getScrollTop()
onMounted(() => {
scrollTop.value = getScrollTop();
- scroll_element.addEventListener('scroll', onScroll);
+ window.addEventListener('scroll', onScroll);
});
-onUnmounted(() => scroll_element.removeEventListener('scroll', onScroll));
+onUnmounted(() => window.removeEventListener('scroll', onScroll));
</script>
<style scoped lang="scss">