重叠,我有一个侧边栏的代码防止滚动侧边栏与页脚
<section>
<div class="8u">
</div>
<div class="4u">
<div id="sidebar">
<div id="scroller-anchor"></div>
<div id="scroller" style="margin-top:10px; width:270px">
Content Here
</div>
</div>
</div>
</div>
</section>
<footer>Content Footer</footer>
我现在的问题是,当我滚动屏幕,然后边栏滚动顺利,但是当侧边栏到达页脚然后侧边栏重叠的页脚内容。 I want that sidebar should remain at last position when footer start is reached.
我的jQuery代码滚动边栏:
//<![CDATA[
$(window).load(function(){
$(function() {
var a = function() {
var b = $(window).scrollTop();
var d = $("#scroller-anchor").offset().top;
var c=$("#scroller");
if (b>d) {
c.css({position:"fixed",top:"50px"})
} else {
if (b<=d) {
c.css({position:"relative",top:""})
}
}
};
$(window).scroll(a);a()
});
});//]]>
请在这里帮助。链接到我的JS Fiddle
建立一个[小提琴](http://jsfiddle.net),它会帮助我们得到更好的答案 – Matheus
你的CSS在哪里?这就是你应该控制'#scroller {overflow-y:scroll;}'。这与你的页脚不应该有任何关系。你有滚动整个'部分'? – PHPglue
overflow-y:scroll如何防止重叠。 – Gags