如图,左侧导航栏和内容一起滚动的,每次看完一个标签后,都要回到顶部重新选下个要看的标签。有时找到上次看的标签 都十分麻烦。
使用:复制后到console执行一下
var course = document.querySelector("#navsecond");
var content = document.querySelector("#maincontent");
var tools = document.querySelector("#sidebar");
content.style.float = "right";
course.style.height = "900px";
course.style.overflow = "auto";
course.style.position = "sticky";
course.style.top = "0px";
course.style.backgroundColor = "RGB(252,253,248)"
tools.style.display = "none";
效果:
左边的导航栏固定不动!!!