在我的辩护中 - 我不太了解Javascript。
这是我的网页:www.andrewjalexander.com
这是有人帮助我获得的代码:
window.onscroll = moveEle;
function moveEle() {
//Alter top to be how many pixels you want from the top of the window
var top = 100;
ele = document.getElementById('sidebar');
if(document.body && document.body.scrollTop) {
ele.style.top = (document.body.scrollTop + top) + "px";
} else if(document.documentElement && document.documentElement.scrollTop) {
ele.style.top = (document.documentElement.scrollTop + top) + "px";
}
}
滚动看起来令人难以置信的跳跃。我尝试了CSS,但侧边栏与主要div重叠。
有没有办法滚动,与任何div没有重叠?
答案 0 :(得分:1)
只需添加位置:固定为
现在是<ul style ="position: fixed;">
它重叠但它必须是一个非常小的屏幕。看起来仍然很顺利。