-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (27 loc) · 973 Bytes
/
Copy pathscript.js
File metadata and controls
31 lines (27 loc) · 973 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
29
30
31
function showMenu() {
document.querySelector('.sidebar').classList.add('active');
}
function closeSidebar() {
document.querySelector('.sidebar').classList.remove('active');
}
// Close sidebar when clicking outside on mobile
document.addEventListener('click', (event) => {
const sidebar = document.querySelector('.sidebar');
const hamburger = document.querySelector('.hamburger');
if (!sidebar.contains(event.target) && !hamburger.contains(event.target) && sidebar.classList.contains('active')) {
sidebar.classList.remove('active');
}
});
// Close sidebar when a link is clicked
document.querySelectorAll('.sidebar-links a').forEach(link => {
link.addEventListener('click', () => closeSidebar());
});
// Typed.js initialization
document.addEventListener('DOMContentLoaded', () => {
new Typed('.auto-type', {
strings: [' VISUAL', 'VISUALISER'],
typeSpeed: 100,
backSpeed: 100,
loop: true
});
});