-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (34 loc) · 1.31 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
const sidePanel = document.getElementById("side-panel");
document.getElementById("toggle-panel").addEventListener("click", function () {
sidePanel.classList.toggle("active");
});
// JavaScript to make the chatbot interactive
const chatbotImage = document.getElementById("chatbot-image");
const chatbox = document.getElementById("chatbox");
chatbotImage.addEventListener("click", () => {
chatbotImage.style.display = "none";
chatbox.style.display = "block";
chatbox.classList.add("active");
});
const yesButton = document.getElementById("yes-button");
const noButton = document.getElementById("no-button");
yesButton.addEventListener("click", () => {
alert("Great! How can I assist you?");
});
noButton.addEventListener("click", () => {
chatbotImage.style.display = "block";
chatbox.style.display = "none";
chatbox.classList.remove("active");
});
const footer = document.querySelector(".footer");
const showFooterThreshold = 50;
window.addEventListener("scroll", () => {
const scrollPosition = window.scrollY;
const windowHeight = window.innerHeight;
const contentHeight = document.body.scrollHeight;
if (scrollPosition + windowHeight >= contentHeight - showFooterThreshold) {
footer.style.display = "block";
} else {
footer.style.display = "none";
}
});