-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (26 loc) · 871 Bytes
/
Copy pathscript.js
File metadata and controls
28 lines (26 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { setCurrentYear } from './js/utils.js';
import { initNav, initSmoothScroll, initScrollNav, initScrollHeader } from './js/nav.js';
import { initTheme } from './js/theme.js';
import { initChatbot } from './js/chatbot.js';
import { initReveal } from './js/reveal.js';
document.addEventListener('DOMContentLoaded', () => {
initTheme();
initNav();
initSmoothScroll();
initScrollNav();
initScrollHeader();
setCurrentYear();
initChatbot();
initScrollTop();
initReveal();
});
function initScrollTop() {
const btn = document.getElementById('scroll-top-btn');
if (!btn) return;
window.addEventListener('scroll', () => {
btn.classList.toggle('visible', window.pageYOffset > 400);
}, { passive: true });
btn.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
}