Twitter-bootstrap 3 affixed sidebar overlapping content when window resized and also footer

前端 未结 2 649
天涯浪人
天涯浪人 2021-01-13 05:19

I am having problems with an overlapping sidebar when I use affix for bootstrap 3 and resize the window. Is there a way to add some css class so that instead of overlapping

2条回答
  •  伪装坚强ぢ
    2021-01-13 05:36

    Demo: http://bootply.com/104634

    You should only apply the affix when the screen width is larger that 992 pixels (the breakpoint at which Bootstrap col-md-* starts vertically stacking).

    .affix-top,.affix{
        position: static;
    }
    
    @media (min-width: 992px) {
    
      #sidebar.affix-top {
      position: static;
      }
    
      #sidebar.affix {
      position: fixed;
      top: 100px;
      }
    }
    

    Also, if you want to use the affix on smaller widths you could change your columns to col-sm-* or col-xs-*.

提交回复
热议问题