MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 280:
 
/* ======================================================= */
/* FLOATING TOC: CLICK TITLE TO SCROLL TO TOP (ROBUST) */
/* ======================================================= */
$(document).ready(function() {
// ListenWe foruse clicks'body' onto ensure we catch the TOCelement even if it loads titlelate
$(document'body').on('click touchstart', '#cps-toc-title', function(e) {
// 1. ScrollStop toany theother topmobile oftouch theevents pagefrom smoothlyinterfering
e.preventDefault();
window.scrollTo({ top: 0, behavior: 'smooth' });
e.stopPropagation();
 
// 2. OPTIONAL: Uncomment the line below if you also
// want2. theScroll TOCboth menuHTML and BODY to closecover automaticallyall afterbrowser clicking.types
// $('#cps-toc-overlayhtml, body').removeClassanimate('is-open'{ scrollTop: 0 }, 300);
 
// 3. Close the TOC Overlay so you can see the top of the page
$('#cps-toc-overlay').removeClass('is-open');
});
});