MediaWiki:Jump-button.js: Unterschied zwischen den Versionen
Aus LohnAs Wiki Test
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „// JavaScript source code var jumpPos = 0 // When the user scrolls down 20px from the top of the document, show the button window.onscroll = function() {scr…“) |
(kein Unterschied)
|
Version vom 24. Juli 2018, 09:58 Uhr
// JavaScript source code
var jumpPos = 0
// 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 > 400 || document.documentElement.scrollTop > 400) {
document.getElementById("jump-button").style.display = "block";
} else {
document.getElementById("jump-button").style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}