MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 278:
}, { passive: true });
})();
 
/* ======================================================= */
/* FLOATING TOC: CLICK TITLE TO SCROLL TO TOP (ROBUST) */
/* ======================================================= */
$(document).ready(function() {
// We use 'body' to ensure we catch the element even if it loads late
$('body').on('click touchstart', '#cps-toc-title', function(e) {
// 1. Stop any other mobile touch events from interfering
e.preventDefault();
e.stopPropagation();
 
// 2. Scroll both HTML and BODY to cover all browser types
$('html, body').animate({ scrollTop: 0 }, 300);
 
// 3. Close the TOC Overlay so you can see the top of the page
$('#cps-toc-overlay').removeClass('is-open');
});
});
 
/* DO NOT ADD CODE BELOW THIS LINE */