你好
我认为你可以使用 @Johani 的绝妙解决方案。
类似这样 ![]()
创建一个新组件并添加以下内容。
Header section
<div class="header-anchor"></div>
<script type="text/discourse-plugin" version="0.8">
if (!"IntersectionObserver" in window) return;
const { on } = require("discourse-common/utils/decorators");
const stickyClass = "sticky";
api.modifyClass("component:site-header", {
@on("didInsertElement")
stickyHeaderCheck() {
const anchor = document.querySelector(".header-anchor");
const header = this.element;
new IntersectionObserver(entries => {
if (!entries[0].isIntersecting) {
header.classList.add(stickyClass);
} else {
header.classList.remove(stickyClass);
}
}).observe(anchor);
}
});
</script>
CSS section
.d-header {
#site-logo.logo-big {
display: none;
}
.sticky & {
#site-logo.logo-big {
display: inline;
}
}
}
这将隐藏顶部的徽标,并且仅在滚动时显示。