Skip to content

Commit

Permalink
docs(core): update comments scroll button
Browse files Browse the repository at this point in the history
Improve wording, formatting of existing comments
on scroll button JavaScript.
  • Loading branch information
koeaw committed Oct 9, 2024
1 parent 57ff120 commit a08172d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apis_core/core/static/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ function configHtmx() {
/* scroll-to-top button */
function scrollButton() {

//Get the button
// get the button
let mybutton = document.getElementById("btn-back-to-top");

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

// show button when user has scrolled down 20px from top of document
function scrollFunction() {
if (
document.body.scrollTop > 20 ||
Expand All @@ -42,7 +42,8 @@ function scrollButton() {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document

// scroll back up on click on button
mybutton.addEventListener("click", backToTop);

function backToTop() {
Expand Down

0 comments on commit a08172d

Please sign in to comment.