MediaWiki:Common.js

From Realm Of Thrones
Revision as of 18:33, 12 April 2025 by SitX (talk | contribs)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function () {
  const $button = $('<div id="back-to-top">Back to Top ↑</div>');

  $('body').append($button);

  $button.on('click', function () {
    $('html, body').animate({ scrollTop: 0 }, 500);
  });

  $(window).on('scroll', function () {
    if ($(this).scrollTop() > 300) {
      $button.fadeIn();
    } else {
      $button.fadeOut();
    }
  });
});