-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
44 lines (36 loc) · 1.54 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
42
43
44
// Optional: Example of adding search functionality
// document.addEventListener('DOMContentLoaded', () => {
// const searchInput = document.querySelector('#search');
// const cards = document.querySelectorAll('.card');
// searchInput.addEventListener('input', () => {
// const query = searchInput.value.toLowerCase();
// cards.forEach(card => {
// const name = card.querySelector('h2').textContent.toLowerCase();
// card.style.display = name.includes(query) ? '' : 'none';
// });
// });
// });
const searchInput = document.getElementById("search");
const cards = document.querySelectorAll(".card");
searchInput.addEventListener("input", function () {
const searchValue = searchInput.value.toLowerCase();
cards.forEach((card) => {
const name = card.querySelector("h2").textContent.toLowerCase();
const skills = card.querySelector("p").textContent.toLowerCase();
// Check if the search value matches name or skills
if (name.includes(searchValue) || skills.includes(searchValue)) {
card.style.display = "block"; // Show card
} else {
card.style.display = "none"; // Hide card
}
});
});
// document.addEventListener("DOMContentLoaded", () => {
// document.body.classList.add("loaded");
// });
document.addEventListener("DOMContentLoaded", () => {
document.body.classList.add("loaded");
setTimeout(() => {
document.getElementById("loading-spinner").style.display = "none";
}, 500); /* Match the fade-out duration */
});