Skip to content

Commit 4bd879f

Browse files
refactor(aos.js, vue-smooth-scroll.js, IndexPage.vue): Simplify AOS initialization and remove delays
Refactor AOS initialization in `aos.js` to remove client-side checks and streamline configuration. Update `IndexPage.vue` to eliminate AOS delay attributes for a more uniform animation effect. Changes: - Simplified AOS initialization in `aos.js` - Removed delay attributes from AOS elements in `IndexPage.vue` for consistent animation timing
1 parent dca89fd commit 4bd879f

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/boot/aos.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { boot } from 'quasar/wrappers';
22
import AOS from 'aos';
33
import 'aos/dist/aos.css'; // You can also use <link> for styles
4-
// ..
5-
export default boot(({ app }) => {
6-
AOS.init();
4+
5+
export default boot(() => {
6+
AOS.init({
7+
once: true, // Don't trigger animations on scroll back up
8+
});
79
});

src/boot/vue-smooth-scroll.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import { boot } from 'quasar/wrappers';
12
import VueSmoothScroll from 'vue3-smooth-scroll';
2-
export default ({ app }) => {
3+
4+
export default boot(({ app }) => {
35
app.use(VueSmoothScroll);
4-
};
6+
});

src/layouts/MainLayout.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,16 @@ export default {
178178
}
179179
180180
function onScrollToTop () {
181-
smoothScroll({
182-
scrollTo: document.getElementById('top'),
183-
updateHistory: false,
184-
});
181+
if (smoothScroll) {
182+
// Use smoothScroll to scroll to top (position 0)
183+
smoothScroll({
184+
scrollTo: 0,
185+
updateHistory: false,
186+
});
187+
} else {
188+
// Fallback to native smooth scroll
189+
window.scrollTo({ top: 0, behavior: 'smooth' });
190+
}
185191
}
186192
187193
function onGoToPanel (card) {

0 commit comments

Comments
 (0)