diff --git a/public/css/style.css b/public/css/style.css index 9feb664..856832c 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -841,4 +841,32 @@ input, textarea, select { .toggle-password svg{ transition:.2s; } +/* scroll to top button */ +#scrollTopBtn { + position: fixed; + bottom: 90px; + right: 20px; + width: 50px; + height: 50px; + border: none; + border-radius: 50%; + cursor: pointer; + font-size: 22px; + z-index: 9999; + + background: #2563eb; + color: white; + opacity: 0; + visibility: hidden; + transition: all 0.3s ease; +} + +#scrollTopBtn.show { + opacity: 1; + visibility: visible; +} + +#scrollTopBtn:hover { + transform: translateY(-4px); +} diff --git a/public/index.html b/public/index.html index 9478a5f..09340c8 100644 --- a/public/index.html +++ b/public/index.html @@ -101,6 +101,10 @@

Loading...

Conn. + + diff --git a/public/js/app.js b/public/js/app.js index 4e56d47..c5fdf6e 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -409,3 +409,20 @@ renderLinks(); }); })(); +// ─ ─ ─ Scroll to Top Button ─ ─ ─ +const scrollTopBtn = document.getElementById("scrollTopBtn"); + +window.addEventListener("scroll", () => { + if (window.scrollY > 300) { + scrollTopBtn.classList.add("show"); + } else { + scrollTopBtn.classList.remove("show"); + } +}); + +scrollTopBtn.addEventListener("click", () => { + window.scrollTo({ + top: 0, + behavior: "smooth" + }); +}); \ No newline at end of file