LLWiki正在建設中,歡迎加入我們!
「Widget:游戏主界面」修訂間的差異
跳至導覽
跳至搜尋
小 標籤:流動版網頁編輯 流動版編輯 |
小 標籤:流動版網頁編輯 流動版編輯 |
||
第5行: | 第5行: | ||
ele.href = 'javascript:void(0)'; |
ele.href = 'javascript:void(0)'; |
||
}); |
}); |
||
var eleStatic = document.querySelector('.start-screen') |
var eleStatic = document.querySelector('.start-screen'), |
||
⚫ | |||
document.querySelector('#mw-content-text > .mw-parser-output' |
parent = document.querySelector('#mw-content-text > .mw-parser-output'); |
||
⚫ | |||
parent.appendChild(eleStatic); |
|||
parent.appendChild(eleFixed); |
|||
eleFixed.style.width = eleStatic.getBoundingClientRect().width + 'px'; |
eleFixed.style.width = eleStatic.getBoundingClientRect().width + 'px'; |
||
eleStatic.style.visibility = 'hidden'; |
eleStatic.style.visibility = 'hidden'; |
於 2020年10月6日 (二) 01:19 的修訂
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.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;
}
/*