diff --git a/src/app.js b/src/app.js index 70bb6d2..c5c0ae1 100644 --- a/src/app.js +++ b/src/app.js @@ -180,4 +180,24 @@ function initializeSearch() { searchButton.addEventListener('click', () => { displayContributors(searchInput.value); }); -} \ No newline at end of file +} + +// Get the button element +const backToTopBtn = document.getElementById('backToTopBtn'); + +// Show the button when the user scrolls down 100px from the top +window.onscroll = function () { + if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { + backToTopBtn.style.display = "block"; + } else { + backToTopBtn.style.display = "none"; + } +}; + +// Smooth scroll to the top when the button is clicked +backToTopBtn.addEventListener('click', function () { + window.scrollTo({ + top: 0, + behavior: 'smooth' + }); +}); \ No newline at end of file diff --git a/src/contributors.json b/src/contributors.json index b4871b7..dc5b98b 100644 --- a/src/contributors.json +++ b/src/contributors.json @@ -28,5 +28,8 @@ }, { "name": "Bupendra" + }, + { + "name": "Sanket" } ] diff --git a/src/index.html b/src/index.html index fcac720..1e5cb25 100644 --- a/src/index.html +++ b/src/index.html @@ -75,6 +75,9 @@