-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (25 loc) · 997 Bytes
/
index.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
var image = document.getElementById('moving-image');
image.addEventListener('click', function() {
image.classList.toggle('move');
});
const motionObject = document.getElementById('pointing');
const triggerArea = document.getElementById('trigger-area');
triggerArea.addEventListener('mouseenter', () => {
motionObject.style.animationPlayState = 'running'; // Start the animation
});
triggerArea.addEventListener('mouseleave', () => {
motionObject.style.animationPlayState = 'paused'; // Pause the animation
});
function toggleMobileMenu() {
var mobileMenu = document.getElementById("mobileMenu");
mobileMenu.classList.toggle("show");
}
function preventLinkClick(event) {
event.preventDefault();
var mobileMenu = document.getElementById("mobileMenu");
mobileMenu.classList.remove("show");
}
var mobileLinks = document.querySelectorAll('.mobile-menu a');
mobileLinks.forEach(function(link) {
link.addEventListener('click', preventLinkClick);
});