Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

We are currently changing the appearance of the wiki to a responsive theme to eliminate switching between desktop and mobile themes. Please report any issues on the Wiki Support page



Difference between revisions of "ScrollTop.js"

From Dragon Mania Legends Wiki

(Add some js for scroll to top button)
(No difference)

Revision as of 23:37, 13 July 2019

// 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("myBtn").style.display = "block";
  } else {
    document.getElementById("myBtn").style.display = "none";

// When users click on Top button, scroll up
function topFunction() {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;