You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
In MediaWiki:Common.js add the following: mw.loader.load( '/index.php?title=MediaWiki:Scroll-to-Top.js&action=raw&ctype=text/javascript' );
Create a MediaWiki:Scroll-to-Top.js and put the following in it:
/* -- SCROLL TO TOP BUTTON -- */
/* Insert Top Button after Body Content */
$(function() {
$('<button onclick="topFunction()" id="topBtn" title="Go to top"></button>').insertAfter('div#mw-content-text');
});
// When users scroll down 100px, show the Top button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
document.getElementById("topBtn").style.display = "block";
} else {
document.getElementById("topBtn").style.display = "none";
}
}
// When users click on Top button, scroll up
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
In MediaWiki:Pivot.css add some CSS to style it (I use a font-awesome arrow-up):
Feature request: Adding a Top button to scroll back to the top on longer pages. :)
The text was updated successfully, but these errors were encountered: