MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary Tags: Mobile edit Mobile web edit |
||
| Line 6: | Line 6: | ||
topButton.id = 'top-button'; | topButton.id = 'top-button'; | ||
document.body.appendChild(topButton); | |||
window.addEventListener('scroll', function (e) { | |||
if (window.scrollY > 300) { | |||
topButton.classList.add('active'); | |||
} else { | |||
topButton.classList.remove('active'); | |||
} | |||
}); | |||
topButton.addEventListener('click', function (e) { | |||
try { | |||
window.scrollTo({ | |||
top: 0, | |||
left: 0, | |||
behavior: 'smooth', | |||
}); | |||
} catch (e) { | |||
window.scrollTo(0, 0); | |||
} | |||
}); | |||
/* 대문 섹션 토글 */ | /* 대문 섹션 토글 */ | ||
if (mw.config.get('wgPageName') == '대문' || mw.config.get('wgPageName') == '대문테스트') { | if (mw.config.get('wgPageName') == '대문' || mw.config.get('wgPageName') == '대문테스트') { | ||