forked from Gyanthakur/Dev_Profiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
45 lines (34 loc) · 1.43 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
45
const searchInput = document.getElementById('searchInput');
const profiles = document.querySelectorAll('.profile');
const date = document.getElementById('dates')
let currentDate = new Date()
let currentYear = currentDate.getFullYear()
date.innerHTML = currentYear
searchInput.addEventListener('input', filterProfiles);
function filterProfiles() {
const query = searchInput.value.toLowerCase();
profiles.forEach((profile) => {
const name = profile.querySelector('.name').textContent.toLowerCase();
const skills = profile.querySelector('.skills').textContent.toLowerCase();
if (name.includes(query) || skills.includes(query)) {
profile.style.display = 'block'; // Show matching profiles
} else {
profile.style.display = 'none'; // Hide non-matching profiles
}
});
}
const darkMode = document.querySelector(".dark-btn");
var icon=document.getElementById("icon");
darkMode.addEventListener("click", () => {
document.body.classList.toggle("light-background");
if(document.body.classList.contains("light-background")){
icon.src="Sun.png";
}else{
icon.src="Moon.png";
}
darkMode.classList.toggle("icon-position")
darkMode.classList.toggle("light-background");
darkMode.classList.toggle("icon-color")
document.querySelector(".title").classList.toggle("text-color");
document.querySelector("footer").classList.toggle("text-color");
});