assetflow/static/js/handleSidebarTriangles.js

22 lines
532 B
JavaScript
Raw Normal View History

2023-05-15 00:21:53 +02:00
const trinagles = $('.dropdownIndicator');
2023-05-21 00:42:37 +02:00
console.log(`Found ${trinagles.length} triangles`)
2023-05-15 00:21:53 +02:00
trinagles.each(function () {
var target = $(this.dataset.refTarget);
2023-05-21 00:42:37 +02:00
var triTar = $(this);
// Apply rotate if target is open
if (target.hasClass('show')) {
$(this).addClass('rotate');
}
2023-05-15 00:21:53 +02:00
target.on('show.bs.collapse', function () {
2023-05-21 00:42:37 +02:00
$(triTar).addClass('rotate');
$(triTar).removeClass('derotate');
2023-05-15 00:21:53 +02:00
});
target.on('hide.bs.collapse', function () {
2023-05-21 00:42:37 +02:00
$(triTar).removeClass('rotate');
$(triTar).addClass('derotate');
2023-05-15 00:21:53 +02:00
});
});