scroll-up-button
This commit is contained in:
parent
6d33755e9e
commit
3acf94933e
6 changed files with 44 additions and 1 deletions
|
|
@ -617,6 +617,17 @@ input[type="radio"] {
|
||||||
border: 2px solid #2d8a49;
|
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 {
|
.test {
|
||||||
color: #59d1da;
|
color: #59d1da;
|
||||||
}
|
}
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<button class="scroll-up-button">^</button>
|
||||||
|
|
||||||
<div id="background"></div>
|
<div id="background"></div>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-prototype-builtins */
|
/* eslint-disable no-prototype-builtins */
|
||||||
|
|
||||||
// ---------------- Load main Hollow Knight database file ----------------- //
|
// ---------------- Load main Hollow Knight database files ----------------- //
|
||||||
|
|
||||||
import HK from "./hk-database.js";
|
import HK from "./hk-database.js";
|
||||||
import MAP from "./hk-dictionary.js";
|
import MAP from "./hk-dictionary.js";
|
||||||
|
|
|
||||||
0
src/js/hk-functions.js
Normal file
0
src/js/hk-functions.js
Normal file
|
|
@ -10,6 +10,8 @@ require("../css/style.css");
|
||||||
// required for meta tags (social) to be visible by Webpack
|
// required for meta tags (social) to be visible by Webpack
|
||||||
require("../img/thumbnail1200x628.jpg");
|
require("../img/thumbnail1200x628.jpg");
|
||||||
|
|
||||||
|
require("./page-functions.js");
|
||||||
|
|
||||||
// Instantly load test save file from .json (fast Debugging script)
|
// Instantly load test save file from .json (fast Debugging script)
|
||||||
// require("./LoadJson.js");
|
// require("./LoadJson.js");
|
||||||
|
|
||||||
|
|
|
||||||
28
src/js/page-functions.js
Normal file
28
src/js/page-functions.js
Normal 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);
|
||||||
Loading…
Reference in a new issue