jquery - 页脚上方的 float 社交图标

标签 jquery html css

当涉及到网页的固定 div 元素时,我需要一些关于如何最好地解决问题的指导。

问题: 全宽水平固定社交图标在移动屏幕底部可见,并在用户滚动页面时随您移动。当用户滚动并到达网页末尾时,社交图标会与页脚区域重叠。

期望的目标: 期望的结果是在网页底部显示全宽水平固定社交图标,但是,希望图标停止在页脚之前而不与页脚重叠。

例子:

enter image description here

我应该如何处理这似乎是一个普遍问题?谢谢 :)

最佳答案

如果您将 padding-bottom 添加到等于固定元素高度的页脚,则页脚将滚动到固定 div 上方的 View 中。这与 OP 提出的顺序相反,但却是最简单的解决方案:

#container {
  height: 1000px;
  width: 100px;
  background: silver;
  position: relative;
}
#footer {
  height: 50px;
  width: 100%;
  padding-bottom: 50px;
  background: black;
  position: absolute;
  bottom: 0;
}
#fixed {
  height: 50px;
  width: 100px;
  position: fixed;
  bottom: 0;
  background: blue;
}
<div id="container">
  <div id="footer"></div>
</div>
<div id="fixed"></div>

关于jquery - 页脚上方的 float 社交图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40433309/

相关文章:

带有图像缩略图的 jQuery Slider

jQuery 在显示/隐藏之间缓动动画

javascript - Angular js渲染速度[慢]阻止加载程序显示

html - 如果不是 child ,如何不让元素刹车

css - 如何在 .NET Framework 元素中禁用 SCSS 编译文件

javascript - 如何修复我的代码以获得使下拉菜单起作用的功能?

javascript - QUnit - 循环测试,索引始终相同

html - dd > 标签导致奇怪的边框*在 Chrome* 上*(基础框架)

c# - 弹出 - 阻止了带有来源的框架

到其他目录的 Html 链接在 Ubuntu 上无法正确链接