Total Complexity | 6 |
Complexity/F | 2 |
Lines of Code | 32 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | $(document).ready(function () { |
||
2 | |||
3 | $('.navbar .dropdown-item.dropdown').on('click', function (e) { |
||
4 | var $el = $(this).children('.dropdown-toggle'); |
||
5 | if ($el.length > 0 && $(e.target).hasClass('dropdown-toggle')) { |
||
6 | var $parent = $el.offsetParent(".dropdown-menu"); |
||
7 | $(this).parent("li").toggleClass('open'); |
||
8 | |||
9 | if (!$parent.parent().hasClass('navbar-nav')) { |
||
10 | if ($parent.hasClass('show')) { |
||
11 | $parent.removeClass('show'); |
||
12 | $el.next().removeClass('show'); |
||
13 | $el.next().css({"top": -999, "left": -999}); |
||
14 | } else { |
||
15 | $parent.parent().find('.show').removeClass('show'); |
||
16 | $parent.addClass('show'); |
||
17 | $el.next().addClass('show'); |
||
18 | $el.next().css({"top": $el[0].offsetTop, "left": $parent.outerWidth() - 4}); |
||
19 | } |
||
20 | e.preventDefault(); |
||
21 | e.stopPropagation(); |
||
22 | } |
||
23 | return; |
||
|
|||
24 | } |
||
25 | }); |
||
26 | |||
27 | $('.navbar .dropdown').on('hidden.bs.dropdown', function () { |
||
28 | $(this).find('li.dropdown').removeClass('show open'); |
||
29 | $(this).find('ul.dropdown-menu').removeClass('show open'); |
||
30 | }); |
||
31 | |||
32 | }); |
||
33 |