responsive-1.less 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //side menu toggler in mobile view
  2. @sidebar-toggler-background: #444;
  3. @sidebar-toggler-color: #FFF;
  4. .main-container .menu-toggler {
  5. display: none;
  6. }
  7. .enable_responsive_menu() when(@enable-responsive-menu = true) {
  8. @duration : 0.2s;
  9. //responsive sidebar
  10. @media only screen and (max-width: @grid-float-breakpoint-max) {
  11. .sidebar.responsive:before {
  12. display: none;
  13. }
  14. .sidebar.responsive {
  15. .box-shadow(~"2px 1px 2px 0 rgba(0,0,0,0.15)");
  16. z-index: @zindex-sidebar-fixed;
  17. overflow: hidden;
  18. max-height: 0;
  19. .transform(translateX(-@sidebar-width - 10));
  20. //"left" or "margin-left" transition is slow on Chrome, so we use translateX
  21. -webkit-transition: -webkit-transform @duration linear 0s, max-height 0s linear @duration;
  22. -moz-transition: -moz-transform @duration linear 0s, max-height 0s linear @duration;
  23. -o-transition: -o-transform @duration linear 0s, max-height 0s linear @duration;
  24. transition: transform @duration linear 0s, max-height 0s linear @duration;
  25. position: relative;
  26. bottom: auto;
  27. //top: auto has a problem with android default browser if sidebar is fixed
  28. left: @sidebar-width;
  29. margin-left: -(@sidebar-width);
  30. //why are we doing this?
  31. //we don't use "position: absolute" so that our page's height is at least as tall as .sidebar
  32. //and therefore our page background is white when sidebar is expanded (whitened by .main-container:before) (it won't happen on position: absolute)
  33. //but "position: relative" will push ".main-content" to left
  34. //so we use negative "margin-left" on .sidebar to get more space and bring back .main-content
  35. //and then we move .sidebar again back to its place using "left" property
  36. //so it will look like the "position: absolute" alternative, but it's not
  37. }
  38. }
  39. @media (min-width: @screen-compact-menu) and (max-width: @grid-float-breakpoint-max) {
  40. .sidebar.responsive.compact {
  41. .transform(translateX(-@sidebar-compact-width - 10));
  42. &.push_away.display + .main-content {
  43. .transform(translateX(@sidebar-compact-width));
  44. }
  45. .navbar.navbar-fixed-top + .main-container & {
  46. &.push_away.display ~ .footer .footer-inner {
  47. .transform(translateX(@sidebar-compact-width));
  48. }
  49. }
  50. }
  51. }
  52. @media only screen and (max-width: @grid-float-breakpoint-max) {
  53. .sidebar.responsive {
  54. &.menu-min {
  55. .transform(translateX(-@sidebar-min-width - 10));
  56. }
  57. &.display {
  58. .transform(none) !important;//to override .rtl's
  59. overflow: visible;
  60. max-height: 2000px;
  61. -webkit-transition-delay: 0s;
  62. -moz-transition-delay: 0s;
  63. -o-transition-delay: 0s;
  64. transition-delay: 0s;
  65. }
  66. //push .main-content to left
  67. &.push_away {
  68. .box-shadow(none) !important;//to override .RTL's
  69. &:before {
  70. display: block !important;
  71. }
  72. + .main-content {
  73. -webkit-transition: -webkit-transform @duration linear 0s;
  74. -moz-transition: -moz-transform @duration linear 0s;
  75. -o-transition: -o-transform @duration linear 0s;
  76. transition: transform @duration linear 0s;
  77. }
  78. &.display + .main-content {
  79. .transform(translateX(@sidebar-width));
  80. }
  81. &.display.menu-min + .main-content {
  82. .transform(translateX(@sidebar-min-width));
  83. }
  84. }
  85. .navbar.navbar-fixed-top + .main-container & {
  86. &.push_away {
  87. &:before {
  88. height: 5000px;
  89. }
  90. .enable_footer_responsive_menu_push() when (@enable-footer = true) {
  91. ~ .footer .footer-inner {
  92. -webkit-transition: -webkit-transform @duration linear 0s;
  93. -moz-transition: -moz-transform @duration linear 0s;
  94. -o-transition: -o-transform @duration linear 0s;
  95. transition: transform @duration linear 0s;
  96. }
  97. &.display ~ .footer .footer-inner {
  98. .transform(translateX(@sidebar-width));
  99. }
  100. &.display.menu-min ~ .footer .footer-inner {
  101. .transform(translateX(@sidebar-min-width));
  102. }
  103. }
  104. .enable_footer_responsive_menu_push();
  105. }
  106. }
  107. // &.menu-min .nav-list > li.active:after {
  108. //display: block;
  109. // }
  110. + .main-content {
  111. margin-left: 0 !important;
  112. margin-right: 0 !important;//to override rtl's
  113. }
  114. }
  115. }
  116. .enable_container_responsive_1() when(@enable-container = true) {
  117. //maybe disable transition when it is not good enough!
  118. @media only screen and (min-width: @screen-sm-min) and (max-width: @grid-float-breakpoint-max) {
  119. .main-container.container .sidebar.responsive {
  120. -webkit-transition: none;
  121. -moz-transition: none;
  122. -o-transition: none;
  123. transition: none;
  124. display: none;
  125. &:before {
  126. display: none !important;
  127. }
  128. &.display {
  129. display: block;
  130. }
  131. &.push_away {
  132. + .main-content, ~ .footer .footer-inner {
  133. -webkit-transition: none !important;
  134. -moz-transition: none !important;
  135. -o-transition: none !important;
  136. transition: none !important;
  137. .transform(none) !important;
  138. }
  139. }
  140. }
  141. }
  142. }
  143. .enable_container_responsive_1();
  144. }
  145. .enable_responsive_menu();
  146. //************************************************************************************
  147. //remove the following to disable fixed sidebar (style1 - default) on smaller devices
  148. //if you also want to disable fixed breadcrumbs on smalelr devices, refer to breadcrumbs.less
  149. @media only screen and (max-width: @grid-float-breakpoint-max) {
  150. .responsive.sidebar-fixed {
  151. position: fixed;
  152. }
  153. .main-container .menu-toggler.fixed {
  154. position: fixed;
  155. left: auto;
  156. z-index: @zindex-sidebar-fixed - 1;
  157. -moz-backface-visibility: hidden;
  158. }
  159. }