User:BrandonXLF/ToTopButton.js

/*** To Top Button ***/

// Adds a floating "go to top" button on the bottom-right of the screen // Documentation at en:w:User:BrandonXLF/TopButton // By en:w:User:BrandonXLF

$(function {	mw.loader.load('https://en.wikipedia.org/wiki/User:BrandonXLF/ToTopButton.css?action=raw&ctype=text/css', 'text/css');

var circle = $(' ') .appendTo('body') .addClass('topButtonCircle') .on('click', function {			$('html').animate({scrollTop: 0});		}) .append(' ');

$(window).scroll(function {		if ($(window).scrollTop > 100) {			circle.fadeIn;		} else {			circle.fadeOut;		}	}); });