-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (49 loc) · 2.07 KB
/
script.js
File metadata and controls
58 lines (49 loc) · 2.07 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
document.addEventListener("DOMContentLoaded", function () {
// Theme Toggle
const themeToggle = document.getElementById("theme-toggle");
const socialIcons = document.querySelector(".social-icons img");
const image = document.querySelector(".image");
themeToggle.addEventListener("click", function () {
document.body.classList.toggle("dark-theme");
// Change image source based on dark mode
if (document.body.classList.contains("dark-theme")) {
socialIcons.src = "Resources/Frame 1597884138.png";
} else {
socialIcons.src = "Resources/Frame 1597884102.png";
}
if(document.body.classList.contains("dark-theme")) {
image.src = "Resources/image 86 new.png";
} else {
image.src = "Resources/image 86.png";
}
});
// Changing Text Effect
const changingText = document.querySelector(".changing-text");
const changingAbout = document.querySelector(".changing-about");
const words = ["Algorithms", "Hardware", "Machine Learning", "Information"];
let index = 0;
function changeWord() {
index = (index + 1) % words.length;
changingText.textContent = words[index];
changingAbout.textContent = words[index];
}
setInterval(changeWord, 2000);
// Feedback Submission
const feedbackInput = document.getElementById("feedback-input");
const submitFeedback = document.getElementById("submit-feedback");
const thankYouMessage = document.getElementById("thank-you");
submitFeedback.addEventListener("click", function () {
if (feedbackInput.value.trim() !== "") {
thankYouMessage.classList.remove("hidden");
setTimeout(() => {
thankYouMessage.classList.add("hidden");
feedbackInput.value = "";
}, 3000);
}
});
// Scroll to Top Button
const scrollToTopBtn = document.getElementById("scroll-to-top");
scrollToTopBtn.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
});