We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc56bc1 commit b5b9cc0Copy full SHA for b5b9cc0
script.js
@@ -423,4 +423,18 @@ const sampleProjects = [
423
grabCursor: true,
424
speed: 600,
425
});
426
-
+ //Scroll to top button functionality
427
+ const scrollToTopBtn = document.getElementById("scrollToTopBtn");
428
+
429
+// Show button when user scrolls down
430
+window.addEventListener("scroll", () => {
431
+ scrollToTopBtn.style.display = window.scrollY > 300 ? "block" : "none";
432
+});
433
434
+// Scroll to top smoothly
435
+scrollToTopBtn.addEventListener("click", () => {
436
+ window.scrollTo({
437
+ top: 0,
438
+ behavior: "smooth"
439
+ });
440
0 commit comments