It is done - we hope you like our new style.
Please remember to make use of the Manual of Style and Code of Conduct during your stay on the wiki.

 Actions

MediaWiki

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;
}