Widget:游戏主界面

Bhsd讨论 | 贡献2020年10月6日 (二) 01:34的版本
Template-info.png 小部件文档
这个文档是内联文档。

请使用{{SIF nav}}调用。

JavaScript脚本:

window.addEventListener('load', function () {
    document.querySelectorAll('.start-screen a').forEach(function(ele) {
        ele.href = 'javascript:void(0)';
    });
    var eleStatic = document.querySelector('.start-screen'),
        eleFixed = eleStatic.cloneNode(true),
        parent = document.querySelector('#mw-content-text > .mw-parser-output');
    parent.appendChild(eleStatic);
    parent.appendChild(eleFixed);
    eleFixed.classList.add('sticky-bottom');
    eleFixed.style.width = eleStatic.getBoundingClientRect().width + 'px';
    eleStatic.style.visibility = 'hidden';
    window.addEventListener('scroll', function() {
        if(eleStatic.getBoundingClientRect().top < eleFixed.getBoundingClientRect().top) {
            eleFixed.style.visibility = 'hidden';
            eleStatic.style.visibility = '';
        }
        else {
            eleFixed.style.visibility = '';
            eleStatic.style.visibility = 'hidden';
        }
    });
});
//

CSS样式表:

 */
.start-screen {
	text-align: center;
}
.start-screen table {
	display: inline-table;
}
.sticky-bottom {
	position: fixed;
	bottom: 3px;
}
/*