function customAccordion() {
var element = $('.accordion');
var item = $('.accordion-item');
item.each(function() {
var currentItem = $(this);
if(currentItem.children('.in').length !== 0) {
currentItem.children('.accordion-title').addClass('accordion-title-active');
}
});
item.children('.accordion-title').on('click', function(event) {
event.preventDefault();
if($(this).hasClass('accordion-title-active')) {
$(this).removeClass('accordion-title-active');
}
else {
if($(this).parent().siblings().children('.accordion-title-active').length !== 0) {
$(this).parent().siblings().children('.accordion-title').removeClass('accordion-title-active');
}
$(this).addClass('accordion-title-active');
}
});
}
Custom event accordion bootstrap when it have icon (arrow right > arrow down)
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.