【问题标题】:Twitter Bootstrap Affix: disappears under the footerTwitter Bootstrap Affix:在页脚下消失
【发布时间】:2014-12-13 02:17:27
【问题描述】:

我正在尝试使用 Affix,但我遇到了一些问题:当我向下滚动时 - 我的 affix div 部分消失在页脚下,这里是 jsbin examplecode。我怎样才能防止这种情况发生?

data-offset-bottom="anynumber" - 不工作。

【问题讨论】:

  • 如果您查看 GetBootstrap.com 上的文档,他们使用带有侧边栏和页脚的词缀,脚本中有许多设置,断点内也有 css。拿一部分来学习如何完成你想要的。这是他们为此编写的脚本,注意 .bs-footer,然后查看 css。 getbootstrap.com/docs-assets/js/application.js
  • 偏移量必须像这个例子一样计算:bootply.com/102441

标签: html css twitter-bootstrap twitter-bootstrap-3 affix


【解决方案1】:

这看起来更像是z-index 问题。我相信您可以通过对 .affix 应用比使用 CSS 的页脚更高的 z-index 值来解决此问题。

例子:

如果没有设置,则设置z-index

yourFooter { position:absolute/relative/fixed /* a positioning is a must */ ; z-index: 300 }

然后只需将更高的 z-index 添加到 .affix div。 它已经有了固定的定位,所以不需要为此设置position

注意事项:在计算 z-index 时,请先对所有内容进行测试,确保词缀不会开始出现在您的 modals 和其他人的上方。

希望这行得通。

【讨论】:

    猜你喜欢
    • 2013-02-20
    • 1970-01-01
    • 2012-10-16
    • 1970-01-01
    • 2013-07-31
    • 2020-06-01
    • 1970-01-01
    • 2012-08-17
    • 2013-05-25
    相关资源
    最近更新 更多