Task 2: sidebar滚动和container区域滚动分离

功能:

  • sidebar和container为左右两部分区域, 分开滚动,互不影响;
  • sidebar区域滚动不显示滚动条;
  • 固定sidebar和container上方导航栏;

实现思路:

页面结构为: sidebar 采用了position: fixed; container是float: left

  • 隐藏滚动条
.sidebar {
    float: left;
    width: 222px;
    position: fixed;
    height: calc(~"100% - 82px");
    overflow-y: scroll;
    overflow-x: hidden;
    z-index: 1;

    &::-webkit-scrollbar {
        width: 0;
    }
}
  • 固定导航栏: position: fixed;
.breadcrumb {
        position: fixed;
        top: 48px;
        z-index: 10;
        width: 100%;
        background-color: #f4f4f4;
    }

你可能感兴趣的:(Task 2: sidebar滚动和container区域滚动分离)