scroll-up-button

This commit is contained in:
ReznoRMichael 2021-02-16 18:50:55 +01:00
parent 6d33755e9e
commit 3acf94933e
6 changed files with 44 additions and 1 deletions

View file

@ -617,6 +617,17 @@ input[type="radio"] {
border: 2px solid #2d8a49;
}
.scroll-up-button {
width: 50px;
height: 50px;
text-decoration: none;
position: fixed;
right: 1px;
bottom: 0;
display: none;
z-index: 1100;
}
.test {
color: #59d1da;
}

View file

@ -30,6 +30,8 @@
</head>
<body>
<button class="scroll-up-button">^</button>
<div id="background"></div>
<div id="content">

View file

@ -1,6 +1,6 @@
/* eslint-disable no-prototype-builtins */
// ---------------- Load main Hollow Knight database file ----------------- //
// ---------------- Load main Hollow Knight database files ----------------- //
import HK from "./hk-database.js";
import MAP from "./hk-dictionary.js";

0
src/js/hk-functions.js Normal file
View file

View file

@ -10,6 +10,8 @@ require("../css/style.css");
// required for meta tags (social) to be visible by Webpack
require("../img/thumbnail1200x628.jpg");
require("./page-functions.js");
// Instantly load test save file from .json (fast Debugging script)
// require("./LoadJson.js");

28
src/js/page-functions.js Normal file
View file

@ -0,0 +1,28 @@
/* the document element root (<html>) */
const ROOT = document.documentElement;
function ScrollTo() {
}
function ShowElement() {
}
function HideElement() {
}
function DetectPageScroll() {
/* Maximum number of pixels that can be scrolled by the user */
let scrollTotal = ROOT.scrollHeight - ROOT.clientHeight;
if ((ROOT.scrollTop / scrollTotal ) > 0.80) {
//show button
} else {
//hide button
}
}
document.addEventListener("scroll", DetectPageScroll);