如何移除粘性顶部栏?

the top bar including logo stays sticky whenever I scroll up and down the page.

Acutally I wanna make it sticky only when I scroll up and not sticky when scroll down the page.
if it’s not possible then I just wanna remove sticky feature.

1 个赞

There is no setting to remove the sticky header – it’s a fundamental part of Discourse.

3 个赞

You could disable the stickiness by creating a theme and adding this to your CSS:

.d-header {
    position: relative;
}

This may impact the layout in other ways and cause issues with the dropdown menus, so you’d need to write some additional CSS to get around those problems. Getting started with themes: Structure of themes and theme components.

There are also a lot of additional topics that might help you with general Discourse questions in the howto category.

10 个赞

你好,我很好奇这些具体问题可能是什么?我用检查器禁用了 position: fixed 规则来尝试一下。我操作了菜单,一切似乎都运行正常。
我发现标题高度可能在滚动时会有影响,但我不确定具体会有什么后果。主题时间线:discourse/app/assets/javascripts/discourse/app/widgets/topic-timeline.js at 9482ddff7343d2e913a5177d2cdef100140b57f2 · discourse/discourse · GitHub
键盘快捷键:
discourse/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js at 350fe932cafa2874e5fd87b4d401223754158656 · discourse/discourse · GitHub
偏移量计算器:discourse/app/assets/javascripts/discourse/app/lib/offset-calculator.js at 7a2e8d3ead63c7d99e1069fc7823e933f931ba85 · discourse/discourse · GitHub
我也尝试过设置 position: relative,但这样页面顶部会出现一些空白,而 position: absolute 似乎运行正常。
附言:我知道固定头部对您来说非常重要。我之前对固定头部是接受的,但我正在台湾度过一段长假,整天都得用这台小笔记本电脑屏幕。我将在主题组件中移除它。抱歉,但我必须这么做。这让我感到头晕 :smiley:

2 个赞

可能没有任何相关问题,但这并不是我们见过许多网站采用的做法,因此其测试程度远不如默认行为。

4 个赞