diff --git a/index.html b/index.html index b5c1a80..91dcd7d 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,42 @@ + + @@ -415,6 +450,10 @@

Responsibility

+ + + + + \ No newline at end of file diff --git a/scroll.js b/scroll.js new file mode 100644 index 0000000..d57478f --- /dev/null +++ b/scroll.js @@ -0,0 +1,19 @@ +// Get the button element +const scrollToTopBtn = document.getElementById('scrollToTopBtn'); + +// Show the button when scrolled down 200px +window.onscroll = function() { + if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) { + scrollToTopBtn.style.display = "block"; + } else { + scrollToTopBtn.style.display = "none"; + } +}; + +// Smooth scroll to the top when the button is clicked +scrollToTopBtn.addEventListener('click', function() { + window.scrollTo({ + top: 0, + behavior: 'smooth' + }); +});