Skip to content

Commit 2d0272d

Browse files
authored
Merge pull request #314 from Sushil010/fix/back-to-top
Fixed back to top button
2 parents 79d8468 + f1bd95a commit 2d0272d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,17 @@ document.addEventListener("DOMContentLoaded", function () {
283283
document.body.appendChild(scrollBtn);
284284

285285
window.addEventListener("scroll", () => {
286+
const chatbotButton = document.getElementById("chatbot-button");
286287
if (window.scrollY > 100) {
287288
scrollBtn.classList.add("show");
289+
if (chatbotButton) {
290+
chatbotButton.classList.add("shifted-up");
291+
}
288292
} else {
289293
scrollBtn.classList.remove("show");
294+
if (chatbotButton) {
295+
chatbotButton.classList.remove("shifted-up");
296+
}
290297
}
291298
});
292299

style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,10 +2230,12 @@ body {
22302230
box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
22312231
}
22322232

2233+
/* When back-to-top is visible, keep it at original position */
22332234
.scroll-to-top-btn.show {
22342235
opacity: 1;
22352236
visibility: visible;
22362237
transform: translateY(0);
2238+
bottom: 30px; /* Keep at original position */
22372239
}
22382240

22392241
.scroll-to-top-btn:hover {
@@ -2292,6 +2294,12 @@ body {
22922294
justify-content: center;
22932295
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
22942296
cursor: pointer;
2297+
transition: all 0.3s ease-in-out;
2298+
}
2299+
2300+
/* When back-to-top is visible, move chat button up */
2301+
#chatbot-button.shifted-up {
2302+
bottom: 100px; /* Move up to make space for back-to-top button (30px + 60px + 10px gap) */
22952303
}
22962304
#chatbot-button:hover {
22972305
background: #159943;

0 commit comments

Comments
 (0)