模板:PageBanner:修订间差异
来自Blockland Wiki
更多操作
无编辑摘要 标签:已被回退 |
无编辑摘要 标签:已被回退 |
||
| 第1行: | 第1行: | ||
<div class="page-banner noexcerpt" style=" | <div class="page-banner noexcerpt" id="mainBanner" style="position: absolute; top: 0; left: 0; width: 100vw; z-index: 100; margin: 0 !important;"> | ||
<div class="page-banner-bg" style="background-image: url('{{{image|{{{1|https://cdn.jsdelivr.net/gh/KKBlockE/BlocklandPicturebed@main/main/20260130095720051.png}}}}}}'); background-size: cover; background-position: center;"></div> | <div class="page-banner-bg" style="background-image: url('{{{image|{{{1|https://cdn.jsdelivr.net/gh/KKBlockE/BlocklandPicturebed@main/main/20260130095720051.png}}}}}}'); background-size: cover; background-position: center center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 0;"></div> | ||
<div class="page-banner-content" style="position: relative; text-align: center; padding: 150px 20px; z-index: 2;"> | <div class="page-banner-content" style="position: relative; text-align: center; padding: 150px 20px; z-index: 2;"> | ||
| 第7行: | 第7行: | ||
</div> | </div> | ||
</div> | </div> | ||
<script> | |||
(function() { | |||
var banner = document.getElementById('mainBanner'); | |||
if (banner) { | |||
var height = banner.offsetHeight; | |||
// 为 banner 的下一个兄弟元素(或父级内的第一个内容块)添加上边距,避免内容被遮挡 | |||
var next = banner.nextElementSibling; | |||
if (next && next.style) { | |||
next.style.marginTop = height + 'px'; | |||
} else { | |||
var parent = banner.parentNode; | |||
if (parent && parent.style) { | |||
parent.style.paddingTop = height + 'px'; | |||
} | |||
} | |||
} | |||
})(); | |||
</script> | |||
2026年5月9日 (六) 23:12的版本
<script>
(function() {
var banner = document.getElementById('mainBanner');
if (banner) {
var height = banner.offsetHeight;
// 为 banner 的下一个兄弟元素(或父级内的第一个内容块)添加上边距,避免内容被遮挡
var next = banner.nextElementSibling;
if (next && next.style) {
next.style.marginTop = height + 'px';
} else {
var parent = banner.parentNode;
if (parent && parent.style) {
parent.style.paddingTop = height + 'px';
}
}
}
})();
</script>