안녕하세요
이 문제를 해결하기 위해 @Johani 님의 훌륭한 솔루션을 사용할 수 있습니다.
다음과 같이 진행할 수 있습니다 ![]()
새로운 컴포넌트를 생성하고 아래 내용을 추가하세요.
헤더 섹션
<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 섹션
.d-header {
#site-logo.logo-big {
display: none;
}
.sticky & {
#site-logo.logo-big {
display: inline;
}
}
}
이 코드는 상단의 로고를 숨기고, 스크롤할 때만 표시되도록 합니다.