Difference between revisions of "MediaWiki:Mobile.js"

no edit summary
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
window.onscroll = function() {scrollFunction()};
 
function scrollFunction() {
if(document.getElementById("myBtn")!=null){
    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
      if(document.getElementById("myBtn").style!=null){
        document.getElementById("myBtn").style.display = "block";
        document.getElementById("myBtn").onclick =  function() {topFunction();};
      }
    } else {
      if(document.getElementById("myBtn").style!=null){
        document.getElementById("myBtn").style.display = "none";
      }
    }
    }
}
 
function topFunction() {
console.log("topFunction");
    document.body.scrollTop = 0; // For Safari
    document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
/* All JavaScript here will be loaded for users of the mobile site */
/* All JavaScript here will be loaded for users of the mobile site */