sidebar-fixed.less 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. .sidebar.sidebar-fixed {
  2. position: fixed;
  3. top: auto;
  4. float: none !important;
  5. z-index: @zindex-sidebar-fixed;//???!
  6. &:before {
  7. height: 5000px;
  8. top: auto;
  9. bottom: auto;
  10. }
  11. }
  12. //android's default browser has a problem with "top: auto" when fixed
  13. body.mob-safari {
  14. .sidebar.sidebar-fixed {
  15. top: @navbar-min-height;
  16. }
  17. @media (max-width: @screen-topbar-down) {
  18. .navbar-fixed-top:not(.navbar-collapse) + .main-container .sidebar-fixed {
  19. top: (@navbar-min-height * 2);
  20. }
  21. }
  22. //also when .navbar is fixed, .responsive sidebar becomes automatically fixed
  23. @media (max-width: @grid-float-breakpoint-max) {
  24. .navbar-fixed-top + .main-container .sidebar.responsive {
  25. top: @navbar-min-height;
  26. }
  27. }
  28. @media (max-width: @screen-topbar-down) {
  29. .navbar-fixed-top + .main-container .sidebar.responsive {
  30. top: (@navbar-min-height * 2);
  31. }
  32. }
  33. }
  34. /**
  35. //http://updates.html5rocks.com/2012/09/Stacking-Changes-Coming-to-position-fixed-elements
  36. //webkit & Chrome22+ special case
  37. //webkit is not following the standard specs as of Chrome22+
  38. @media screen and (-webkit-min-device-pixel-ratio:0) {
  39. //like it happens in Firefox&IE, we expect when we set "z-index:auto" for fixed position .sidebar,
  40. //the child .submenu elements "z-index" is independent
  41. //and for example a "z-index:1031" .submenu appears on top of a fixed .navbar with "z-index:1030"
  42. //and a "z-index:1010" .popover appears on top of ".sidebar" but below ".submenu"
  43. //but webkit defines a new stacking context on "fixed" position elements(.sidebar here)
  44. //and the above doesn't happen, in fact .submenu inside fixed .sidebar with "z-index:auto" will appear below everything
  45. //so we set a good(?) "z-index" for .sidebar, but still it's not as good as standard specs (such as in Firefox)
  46. //and we may need other workarounds!
  47. //and you may change it based on your needs
  48. //it's possible have standard functionality in Chrome by going to:
  49. //chrome://flags/#fixed-position-creates-stacking-context
  50. //changing "Fixed position elements create stacking contexts" to "Disabled"
  51. //and removing the following rules
  52. //and assignning a higher "@submenu-zindex"
  53. .sidebar.sidebar-fixed {
  54. z-index: @zindex-sidebar-fixed;//???!
  55. &::before {
  56. height: 5000px;
  57. top: auto;
  58. bottom: auto;
  59. }
  60. }
  61. }
  62. */
  63. //************************************************************************************
  64. //remove the following to disable fixed sidebar (style1 - default) on smaller devices
  65. //if you also want to disable fixed breadcrumbs on smalelr devices, refer to breadcrumbs.less
  66. @media only screen and (max-width: @grid-float-breakpoint-max) {
  67. .responsive.sidebar-fixed {
  68. left: auto;
  69. margin-left: auto;
  70. }
  71. //if `.menu-toggler` button is inside `fixed .navbar` let sidebar become fixed as well
  72. .navbar-fixed-top + .main-container > .responsive {
  73. position: fixed;
  74. left: auto;
  75. margin-left: auto;
  76. //-moz-backface-visibility: hidden;
  77. }
  78. //but if `.menu-toggler` button is inside .main-container, then `fixed .navbar` should have no effect
  79. .navbar-fixed-top + .main-container > .menu-toggler + .responsive {
  80. position: absolute;
  81. left: (@sidebar-width);
  82. margin-left: -(@sidebar-width);
  83. //-moz-backface-visibility: visible;
  84. }
  85. //unless specified as fixed
  86. .navbar-fixed-top + .main-container > .menu-toggler + .responsive.sidebar-fixed {
  87. position: fixed;
  88. left: auto;
  89. margin-left: auto;
  90. //-moz-backface-visibility: hidden;
  91. }
  92. }
  93. @media only screen and (max-width: @grid-float-breakpoint-max) {
  94. .sidebar.responsive.sidebar-fixed {
  95. position: fixed;
  96. left: auto;
  97. margin-left: auto;
  98. }
  99. .main-container .menu-toggler.fixed {
  100. position: fixed;
  101. left: auto;
  102. z-index: @zindex-sidebar-fixed - 1;
  103. //-moz-backface-visibility: hidden;
  104. }
  105. //for responsive style # 2
  106. //becuase ".sidebar.responsive-max" is "position: relative" & "margin-left: -190px"
  107. .sidebar.sidebar-fixed.responsive-max {
  108. position: fixed;
  109. left: auto;
  110. margin-left: auto;
  111. }
  112. }