我需要帮助找到jQuery js修复左侧菜单like this。
固定位置滚动应取决于浏览器标题。
答案 0 :(得分:2)
查看link
中的答案我在答案中准备了一个演示可能会帮助你
您需要的主要内容是 jQuery
$(function(){ // this is the shorthand for document.ready
$(document).scroll(function(){ // this is the scroll event for the document
scrolltop = $(document).scrollTop(); // by this we get the value of the scrolltop ie how much scroll has been don by user
if(parseInt(scrolltop) >= 80) // check if the scroll value is equal to the top of navigation
{
$("#navbar").css({"position":"fixed","top":"0"}); // is yes then make the position fixed to top 0
}
else
{
$("#navbar").css({"position":"absolute","top":"80px"}); // if no then make the position to absolute and set it to 80
}
})
});