Skip to content

Commit fe10b2c

Browse files
authored
Merge pull request #83 from guyromellemagayano/refactor/aos-adjustments
Optimize AOS setup with client-side checks and improve animation timing
2 parents 60bdf15 + 4bd879f commit fe10b2c

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)