Skip to content
Snippets Groups Projects

Issue #3344199: Collapsible javascript event attach multiple times

+ 14
12
@@ -43,18 +43,20 @@
});
});
$('.views_tree_link a', context).on('click', function (e) {
e.preventDefault();
const $parent = $(this).parent();
const $itemList = $parent.parent().children('.item-list');
const isExpanded = $parent.hasClass('views_tree_link_expanded');
$itemList.slideToggle();
$parent.toggleClass(
'views_tree_link_expanded views_tree_link_collapsed',
);
});
$('.views_tree_link a:not(.view-tree-processed)', context)
.addClass('view-tree-processed')
.on('click', function (e) {
e.preventDefault();
const $parent = $(this).parent();
const $itemList = $parent.parent().children('.item-list');
const isExpanded = $parent.hasClass('views_tree_link_expanded');
$itemList.slideToggle();
$parent.toggleClass(
'views_tree_link_expanded views_tree_link_collapsed',
);
});
},
};
})(jQuery, Drupal);
Loading