【问题标题】:How to create sticky headers using jquery and css [closed]如何使用 jquery 和 css 创建粘性标题 [关闭]
【发布时间】:2012-11-20 14:00:56
【问题描述】:

我一直在尝试创建像我们在stickysectionheaders 中看到的那样的粘性标题。但我必须在页面滚动而不是 div 元素滚动上创建它。当滚动条到达页面底部时,我有一些 js 脚本正在运行。

我的是生成页面的php脚本,视图中有单独的文件 IE。 header_view.php

main_view.php

footer_view.php

sticky header 的内容在 main_view.php 中,所以如果我尝试应用 css 样式 position:fixedposition:absolutetop:0 到标题,它们不会出现在屏幕顶部,而是出现在 header_view.php 内容结束之后。它们也不是固定的,当我滚动页面时它们会滚动。如何将它定位到屏幕顶部并固定位置。

【问题讨论】:

  • 向我们展示您生成的 HTML 和 CSS。

标签: javascript jquery html header sticky


【解决方案1】:

你试过给它一个 z-index 吗?

所以

position: absolute;
top: 0;
z-index: 15;//for example

所以标题会在文本上方

【讨论】:

    猜你喜欢
    • 2018-03-23
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-17
    • 2016-02-11
    • 2021-05-29
    相关资源
    最近更新 更多