我有侧边栏,其位置已固定。 当我滚动浏览器窗口时,我需要通过此侧边栏修复页脚重叠。
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.
更多推荐
按固定位置的元素重叠页脚
发布评论