Guest User

Untitled

a guest
Dec 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.14 KB | None | 0 0
  1. jQuery(document).ready(function($) {
  2. 'use strict';
  3.  
  4. var totalWidth = $(window).width(),
  5. layout = $('.layout').css("font-family"),
  6. secondary_sidebar_width = 200;
  7.  
  8.  
  9. // ---------------------------------
  10. // 1. Handheld devices menu toggle
  11. // ---------------------------------
  12. $(".left-toggle-switch").hammer().on("click touchstart", function(e) {
  13. e.preventDefault();
  14. if ($("body").hasClass("left-aside-toggle")) {
  15. $("body").removeClass("left-aside-toggle");
  16. } else {
  17. $("body").addClass("left-aside-toggle");
  18. }
  19. });
  20.  
  21. function AsideHeight() {
  22. var TopBarHeight = $('.main-nav').height(),
  23. calc_wh = wh - TopBarHeight,
  24. menuMargin = $('header').outerHeight(),
  25. containerMargin = $('.main-nav').outerHeight(),
  26. menuHeight = wh - menuMargin;
  27.  
  28. $(window).resize(function() {
  29. if($(window).width() < 801) {
  30. $(".menu").css({
  31. "height": wh + "px"
  32. });
  33. $(".main-container").css('margin-top', containerMargin);
  34. $(".user-profile").load("menus/sidebar-user-profile.html");
  35. $(".menu-container").load("menus/material-sidebar.html");
  36. $('.left-aside-container').slimscroll({
  37. height: calc_wh + 50,
  38. width: "250px"
  39. }).mouseover(function() {
  40. $(this).next('.slimScrollBar');
  41. });
  42.  
  43. if($(window).width() == 800) {
  44. $(".container-sidebar").css({
  45. "height": "100%",
  46. "width": "200px",
  47. "position": "fixed",
  48. "float": "left"
  49. });
  50.  
  51. $('.secondary-sidebar').slimscroll({
  52. height: calc_wh,
  53. width: "200px"
  54. }).mouseover(function() {
  55. $(this).next('.slimScrollBar');
  56. });
  57.  
  58. $(".container-aside").css({
  59. "width": totalWidth - secondary_sidebar_width,
  60. "margin-left": secondary_sidebar_width,
  61. "float": "left"
  62. });
  63. }
  64. }
  65.  
  66. else if(($(window).width() >= 1024)){
  67.  
  68. // ---------------------------------
  69. // 2. Material menu
  70. // ---------------------------------
  71. if(layout == "material"){
  72. $(".menu").addClass(" sidebar");
  73. $(".user-profile").load("menus/sidebar-user-profile.html");
  74. $(".menu-container").load("menus/material-sidebar.html");
  75. $(".sidebar").css({
  76. "height": menuHeight ,
  77. "top": menuMargin
  78. });
  79. $(".main-container").css('margin-top', containerMargin);
  80. $('.sidebar .left-aside-container').slimscroll({
  81. height: menuHeight + 12,
  82. width: "220px"
  83. }).mouseover(function() {
  84. $(this).next('.slimScrollBar');
  85. });
  86. var sidebar_width = 220;
  87. }
  88.  
  89.  
  90. // ---------------------------------
  91. // 3. Dropdown menu
  92. // ---------------------------------
  93. else if(layout == 'dropdown'){
  94. $(".menu").addClass(" dd");
  95. $(".menu").css('top', menuMargin);
  96. $(".main-container").css('margin-top', containerMargin);
  97. $(".menu-container").load("menus/dropdown.html");
  98. var sidebar_width = 0;
  99. }
  100.  
  101.  
  102. // ---------------------------------
  103. // 4. Dropdown label menu
  104. // ---------------------------------
  105. else if(layout == 'dropdown_label'){
  106. $(".menu").addClass(" dd");
  107. $(".menu").css('top', menuMargin);
  108. $(".main-container").css('margin-top', containerMargin);
  109. $(".menu-container").load("menus/dropdown.html");
  110. var sidebar_width = 0;
  111. }
  112.  
  113.  
  114. // ---------------------------------
  115. // 5. Megamenu
  116. // ---------------------------------
  117. else if(layout == 'megamenu'){
  118. $(".menu").addClass(" megamenu");
  119. $(".menu").css('top', menuMargin);
  120. $("ul.main-menu").css('top', menuMargin);
  121. $(".main-container").css('margin-top', containerMargin);
  122. $(".menu-container").load("menus/megamenu.html");
  123. var sidebar_width = 0;
  124.  
  125. $(function () {
  126. menuOpen();
  127. });
  128. function menuOpen() {
  129. $('.dropdown').on('show.bs.dropdown', function (e) {
  130. if ($(window).width() > 750) {
  131. $(this).find('.dropdown-menu').first().stop(true, true).fadeIn('slow');
  132. }
  133. else {
  134. $(this).find('.dropdown-menu').first().stop(true, true).show('slow');
  135. }
  136. });
  137. $('.dropdown').on('hide.bs.dropdown', function (e) {
  138. if ($(window).width() > 750) {
  139. $(this).find('.dropdown-menu').first().stop(true, true).fadeOut('slow');
  140. }
  141. else {
  142. $(this).find('.dropdown-menu').first().stop(true, true).hide('slow');
  143. }
  144. });
  145. }
  146. }
  147.  
  148.  
  149. // ---------------------------------
  150. // 6. Iconic menu
  151. // ---------------------------------
  152. else if(layout == 'iconic'){
  153. $("body").addClass(" iconic-view");
  154. $(".menu").addClass(" iconic-leftbar");
  155. $(".main-container").css('margin-top', containerMargin);
  156. $(".iconic-leftbar").css('margin-top', containerMargin);
  157. $(".user-profile").load("menus/sidebar-user-profile.html");
  158. $(".menu-container").load("menus/iconic.html");
  159. $('ul.sidemenu-sub').slimscroll({
  160. height: menuHeight + 10,
  161. width: "200px"
  162. }).mouseover(function() {
  163. $(this).next('.slimScrollBar');
  164. });
  165. var sidebar_width = 60;
  166. }
  167.  
  168.  
  169. // ---------------------------------
  170. // 7. Sidebar menu
  171. // ---------------------------------
  172. else if(layout == 'sidebar'){
  173. $(".menu").addClass(" leftmenu");
  174. $(".menu-container").load("menus/material-sidebar.html");
  175. $(".main-container").css('margin-top', containerMargin);
  176. $(".leftmenu").css({
  177. "height": menuHeight +1,
  178. "top": menuMargin
  179. });
  180. $('.leftmenu .left-aside-container').slimscroll({
  181. height: menuHeight + 11,
  182. width: "220px"
  183. }).mouseover(function() {
  184. $(this).next('.slimScrollBar');
  185. });
  186. var sidebar_width = 220;
  187. }
  188.  
  189.  
  190. // ---------------------------------
  191. // 8. Boxed menu
  192. // ---------------------------------
  193. else if(layout == 'boxed'){
  194. $(".menu").addClass(" leftmenu");
  195. $(".menu-container").load("menus/material-sidebar.html");
  196. $(".main-container").css('margin-top', containerMargin);
  197. $(".leftmenu").css({
  198. "height": menuHeight +1,
  199. "top": menuMargin
  200. });
  201. $('.leftmenu .left-aside-container').slimscroll({
  202. height: menuHeight + 11,
  203. width: "200px"
  204. }).mouseover(function() {
  205. $(this).next('.slimScrollBar');
  206. });
  207. var sidebar_width = 200;
  208. }
  209.  
  210.  
  211. // ---------------------------------
  212. // 9. Iconbar menu
  213. // ---------------------------------
  214. else if(layout == 'iconbar'){
  215. $(".menu").addClass(" leftmenu");
  216. $(".menu-container").load("menus/material-sidebar.html");
  217. $(".main-container").css('margin-top', containerMargin);
  218. $(".leftmenu").css({
  219. "height": menuHeight +1,
  220. "top": menuMargin
  221. });
  222. $('.leftmenu .left-aside-container').slimscroll({
  223. height: menuHeight + 11,
  224. width: "160px"
  225. }).mouseover(function() {
  226. $(this).next('.slimScrollBar');
  227. });
  228. var sidebar_width = 200;
  229. }
  230.  
  231.  
  232. // ---------------------------------
  233. // 10. Default menu (material)
  234. // ---------------------------------
  235. else if(layout == ''){
  236. $(".menu").addClass(" leftmenu");
  237. $(".menu-container").load("menus/material-sidebar.html");
  238. $(".main-container").css('margin-top', containerMargin);
  239. $(".leftmenu").css({
  240. "height": menuHeight +1,
  241. "top": menuMargin
  242. });
  243. $('.leftmenu .left-aside-container').slimscroll({
  244. height: menuHeight + 11,
  245. width: "200px"
  246. }).mouseover(function() {
  247. $(this).next('.slimScrollBar');
  248. });
  249. var sidebar_width = 200;
  250. }
  251.  
  252. $(".container-sidebar").css({
  253. "height": "100%",
  254. "width": "200px",
  255. "position": "fixed",
  256. "float": "left"
  257. });
  258.  
  259. $('.secondary-sidebar').slimscroll({
  260. height: calc_wh,
  261. width: "200px"
  262. }).mouseover(function() {
  263. $(this).next('.slimScrollBar');
  264. });
  265.  
  266. $(".container-aside").css({
  267. "width": totalWidth - secondary_sidebar_width - sidebar_width,
  268. "margin-left": secondary_sidebar_width,
  269. "float": "left"
  270. });
  271. }
  272. }).resize();
  273. }
  274. AsideHeight();
  275. });
Add Comment
Please, Sign In to add comment