Difference between revisions of "MediaWiki:Gadget-BackToTop.js"
Jump to navigation
Jump to search
(Created page with "$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>'); var amountScrolled = 300; $(window).scroll(function () { if ($(window).scrollTop() > amountScrolled)...") |
(No difference)
|
Latest revision as of 14:42, 5 November 2021
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
var amountScrolled = 300;
$(window).scroll(function () {
if ($(window).scrollTop() > amountScrolled) {
$('a.back-to-top').fadeIn('slow');
} else {
$('a.back-to-top').fadeOut('slow');
}
});
$('a.back-to-top, a.simple-back-to-top').click(function () {
$('html, body').animate({
scrollTop: 0
}, 'fast');
return false;
});