Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m |
m |
||
Line 4: | Line 4: | ||
if(backToTop) { | if(backToTop) { | ||
document.addEventListener("wheel", function() { | document.addEventListener("wheel", function() { | ||
− | + | const isVisible = window.pageYOffset > 400; | |
+ | backToTop.style.display = isVisible ? 'block' : 'none'; | ||
}); | }); | ||
} | } |
Revision as of 23:42, 28 August 2020
/* Any JavaScript here will be loaded for all users on every page load. */
const backToTop = document.getElementById("BackToTop");
if(backToTop) {
document.addEventListener("wheel", function() {
const isVisible = window.pageYOffset > 400;
backToTop.style.display = isVisible ? 'block' : 'none';
});
}