Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,30 @@

<!-- Link to external CSS -->
<link rel="stylesheet" href="src/css/styles.css">

<!-- Scroll to top button start -->
<style>
#scrollToTopBtn {
display: none;
position: fixed;
bottom: 20px;
right: 20px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #a7a7a7;
color: white;
cursor: pointer;
padding: 16px;
border-radius: 99px;
}

#scrollToTopBtn:hover {
background-color: #4d4d4d;
}
</style>
<!-- Scroll to top button styling end -->
</head>
<body>
<header class="header">
Expand Down Expand Up @@ -117,5 +141,31 @@ <h2>#March To Parliament - 23rd/July/2024</h2>
updateDateTime();
setInterval(updateDateTime, 1000);
</script>

<!-- Scroll to top button functionality start -->
<button id="scrollToTopBtn" title="Go to top">Top</button>

<script>
// Get the button
var mybutton = document.getElementById("scrollToTopBtn");

// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};

function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}

// When the user clicks on the button, scroll to the top of the document
mybutton.onclick = function() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
</script>
<!-- Scroll to top button functionality end -->
</body>
</html>