按固定位置的元素重叠页脚

编程入门 行业动态 更新时间:2024-10-25 02:28:21
本文介绍了按固定位置的元素重叠页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有侧边栏,其位置已固定。 当我滚动浏览器窗口时,我需要通过此侧边栏修复页脚重叠。

I have sidebar block, which has position fixed. I need to fix overlapping of the footer by this sidebar when I scroll browser's window.

我试图将侧边栏的位置更改为绝对,计算移动条件并将其移动到滚动事件窗口,但我快速滚动时它无法正常工作。

I tried to change the positioning of sidebar to absolute, calculate conditions of movement and move it on scroll event of window, but it does not work correctly when I scroll fast.

如何在快速滚动窗口时修复此问题,或者建议是否有js插件?

How can I fix this, problem when scrolling the window fast, or, suggest if there is a js plugin for this?

更新:

小提琴: jsfiddle/c863E/1/

(页脚不应与侧边栏重叠)

(Footer should not be overlapped by sidebar)

推荐答案

我之前使用过以下插件执行此操作: www.profilepicture.co.uk/sticky-sidebar-jquery-plugin/

I've used the following plugin for this exact task before: www.profilepicture.co.uk/sticky-sidebar-jquery-plugin/

它工作得很好。

这里还有GitHub项目: github/pmp/jQuery-Stickybox

Also here is the GitHub project: github/p-m-p/jQuery-Stickybox

您需要的解决方案的一般术语是粘性侧边栏。有各种jQuery插件和教程,使用不同的技术来实现这种效果。谷歌搜索jquery sticky sidebar会显示很多。

The general term for the solution you need is a sticky sidebar. There are various jQuery plugins and tutorials with varying techniques for achieving this effect. A Google search for "jquery sticky sidebar" will reveal plenty.

更多推荐

按固定位置的元素重叠页脚

本文发布于:2023-10-08 02:56:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471305.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:元素   位置

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!