257
edits
 (Created page with "→All JavaScript here will be loaded for users of the mobile site:  →All JavaScript here will be loaded for users of the mobile site:   →https://www.mediawiki.org/wiki/Topic:Vqy1kx6q4e0bzvyb:   →Add to MediaWiki:Mobile.js for custom Mobile Menu links    for MW-1.34.2 with MobileFrontend and MinervaNeue    Just replace span text and href to add links:     var timer = setInterval(function() {        if ($('.menu ul:first').length) {            console.log("mobil...")  | 
				|||
| Line 1: | Line 1: | ||
/*   | /* 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 */  | ||