0
侧栏在距离顶部400像素后变得固定。所以我用这个代码堆栈上找到:停止在页脚固定侧栏 - 防止重叠
<div id="gettop"></div>
<script type="text/javascript">
jQuery(function($) {
function fixDiv() {
var $cache = $('#gettop');
if ($(window).scrollTop() > 400)
$cache.css({
'position': 'fixed',
'top': '8px',
'margin-left': '20px',
'border': '1px solid #ccc'
});
else
$cache.css({
'position': 'relative',
'top': 'auto'
});
}
$(window).scroll(fixDiv);
fixDiv();
});
守则的伟大工程。但侧边栏与页脚重叠。我怎样才能防止这一点?
我尝试了一些我在这里找到的代码,但没有成功。
Fixed sidebar on the scroll stop at div
我敢肯定,我在混合代码犯了一个错误。
感谢您的帮助。
我已经测试过了。 z-index在这里不起作用。 – labu77