Difference between revisions of "MediaWiki:Common.js"

From Hubitat Documentation
Jump to: navigation, search
(Created page with "Any JavaScript here will be loaded for all users on every page load.: function hideFade () { // hide #backtotop first $( "#backtotop" ).hide (); // fade in #backtot...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
 
function hideFade () {
 
// hide #backtotop first
 
$( "#backtotop" ).hide ();
 
// fade in #backtotop
 
$( function () {
 
$( window ).scroll( function () {
 
if ( $( this ).scrollTop () > ButtonStart ) {
 
$( '#backtotop' ).fadeIn ();
 
} else {
 
$( '#backtotop' ).fadeOut ();
 
}
 
});
 
});
 
}
 
 
function goToTop (){
 
// scroll body to 0px on click
 
$( 'body,html' ).animate ({
 
scrollTop: 0
 
}, ScrollSpeed );
 
return false;
 
}
 
 
function addBackToTop () {
 
if( skin == 'oasis' ) {
 
$('<li id="backtotop" style="position: absolute; right:20px; top:0px; border:none;"><button type="button" value="Back To Top" onClick="goToTop();">Back To Top</button></li>').appendTo('#WikiaBarWrapper .toolbar > .tools');
 
hideFade ();
 
}
 
}
 
 
var ButtonStart = 800;
 
var ScrollSpeed = 600;
 
 
if( !window.BackToTop  ) {
 
$( document ).ready( function () {
 
addBackToTop ();
 
});
 
}
 
var BackToTop = true; // prevent duplication
 

Latest revision as of 18:13, 20 March 2021

/* Any JavaScript here will be loaded for all users on every page load. */