LLWiki正在建設中,歡迎加入我們

「Widget:游戏主界面」修訂間的差異

出自LLWiki
跳至導覽 跳至搜尋
標籤行動版網頁編輯 行動版編輯
第12行: 第12行:
eleStatic.style.visibility = 'hidden';
eleStatic.style.visibility = 'hidden';
window.addEventListener('scroll', function() {
window.addEventListener('scroll', function() {
setTimeout(function() {
if(eleStatic.getBoundingClientRect().top < eleFixed.offsetTop) {
if(eleStatic.getBoundingClientRect().top < eleFixed.offsetTop) {
eleFixed.style.display = 'none';
eleStatic.style.visibility = '';
eleFixed.style.display = 'none';
eleStatic.style.visibility = '';
}
else {
}
eleFixed.style.display = '';
else {
eleStatic.style.visibility = 'hidden';
eleFixed.style.display = '';
eleStatic.style.visibility = 'hidden';
}
}
}, 400);
});
});
});
});

於 2020年10月6日 (二) 00:04 的修訂

Template-info.png 小部件文檔
這個文檔是內聯文檔。

請使用{{SIF nav}}調用。

JavaScript腳本:

window.addEventListener('load', function () {
    var eleStatic = document.querySelector('.start-screen');
    eleStatic.querySelectorAll('a').forEach(function(ele) {
        ele.href = 'javascript:void(0)';
    });
    var eleFixed = eleStatic.cloneNode(true);
    eleFixed.classList.add('sticky-bottom');
    eleStatic.parentNode.insertBefore(eleFixed, eleStatic);
    eleFixed.style.width = eleStatic.getBoundingClientRect().width + 'px';
    eleStatic.style.visibility = 'hidden';
    window.addEventListener('scroll', function() {
        setTimeout(function() {
            if(eleStatic.getBoundingClientRect().top < eleFixed.offsetTop) {
                eleFixed.style.display = 'none';
                eleStatic.style.visibility = '';
            }
            else {
                eleFixed.style.display = '';
                eleStatic.style.visibility = 'hidden';
            }
        }, 400);
    });
});
//

CSS樣式表:

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