MediaWiki:Common.js: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 244:
// === NEW LOGIC START: Scroll to Top for "Contents" ===
// If the user clicks the "Contents" header (id="mw-toc-heading"), scroll to top (0,0)
// === FIXED CODE ===
window.scrollTo({ top: 0, behavior: 'smooth' });▼
// Delay scroll to let iOS Safari process the overflow change
setTimeout(function() {
if (history.replaceState) {▼
history.replaceState(null, '', window.location.pathname + window.location.search);▼
▲ window.scrollTo({ top: 0, behavior: 'smooth' });
} catch (e) {
window.scrollTo(0, 0);
}
// Fallback for older iOS Safari
▲ return;
document.documentElement.scrollTop = 0;
}▼
document.body.scrollTop = 0;
}, 100);
return;
}
// === NEW LOGIC END ===
| |||