-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
41 lines (33 loc) · 1.08 KB
/
script.js
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
32
33
34
35
36
37
38
39
40
41
console.log('its linked');
var typeData = new Typed(".role", {
strings: [
"Full Stack Developer",
"Web Developer",
"UI-UX Designer",
"Backend Developer",
"Coder",
],
loop: true,
typeSpeed: 100,
backSpeed: 80,
backDelay: 1000,
});
// Toggle mobile navigation menu
const hamburgerMenu = document.getElementById('hamburger-menu');
const navLinks = document.querySelector('.nav-items');
hamburgerMenu.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
// Smooth scrolling when clicking on navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
// Close the mobile navigation menu after clicking on a link
if (navLinks.classList.contains('active')) {
navLinks.classList.remove('active');
}
});
});