-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
60 lines (52 loc) · 2.21 KB
/
script.js
File metadata and controls
60 lines (52 loc) · 2.21 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
document.addEventListener('DOMContentLoaded', function() {
/* Hamburger Menu Animation */
function toggleNavbar() {
var navLinks = document.getElementById("navLinks");
navLinks.classList.toggle("show-nav");
}
/* Scroll Animation */
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
console.log(entry)
if (entry.isIntersecting) {
entry.target.classList.toggle('show');
} else {
entry.target.classList.remove('show');
}
});
});
const hiddenTop = document.querySelectorAll('.hiddenTop');
const hiddenRight = document.querySelectorAll('.hiddenRight');
const hiddenBottom = document.querySelectorAll('.hiddenBottom');
const hiddenLeft = document.querySelectorAll('.hiddenLeft');
hiddenTop.forEach((el) => observer.observe(el));
hiddenRight.forEach((el) => observer.observe(el));
hiddenBottom.forEach((el) => observer.observe(el));
hiddenLeft.forEach((el) => observer.observe(el));
/* Circle Animation */
const circleContainer = document.getElementById('circle-container'); // Get the circle container element
let isCursorInside = false; // Flag variable to track if cursor is inside the circle container
if (circleContainer) {
// Add event listeners for mouseenter and mouseleave
circleContainer.addEventListener('mouseenter', function() {
// Add 'hovered' class when mouse enters the container
this.classList.add('hovered');
});
circleContainer.addEventListener('click', function() {
this.classList.toggle('hovered');
});
}
/* Button for cards */
document.querySelectorAll('.toggle-button').forEach(button => {
button.addEventListener('click', () => {
const content = button.nextElementSibling;
if (content.style.display === 'none' || content.style.display === '') {
content.style.display = 'block';
button.textContent = 'Less Info';
} else {
content.style.display = 'none';
button.textContent = 'More Info';
}
});
});
});