Total Complexity | 7 |
Complexity/F | 3.5 |
Lines of Code | 25 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | (function($) { |
||
2 | 'use strict'; |
||
3 | //Open submenu on hover in compact sidebar mode and horizontal menu mode |
||
4 | $(document).on('mouseenter mouseleave', '.sidebar .nav-item', function(ev) { |
||
5 | var body = $('body'); |
||
6 | var sidebarIconOnly = body.hasClass("sidebar-icon-only"); |
||
7 | var sidebarFixed = body.hasClass("sidebar-fixed"); |
||
8 | if (!('ontouchstart' in document.documentElement)) { |
||
9 | if (sidebarIconOnly) { |
||
10 | if (sidebarFixed) { |
||
11 | if (ev.type === 'mouseenter') { |
||
12 | body.removeClass('sidebar-icon-only'); |
||
13 | } |
||
14 | } else { |
||
15 | var $menuItem = $(this); |
||
16 | if (ev.type === 'mouseenter') { |
||
17 | $menuItem.addClass('hover-open') |
||
18 | } else { |
||
19 | $menuItem.removeClass('hover-open') |
||
20 | } |
||
21 | } |
||
22 | } |
||
23 | } |
||
24 | }); |
||
25 | })(jQuery); |