I need to use an accordion element in sync with an element slider on the ux builder editor
of theme Flatsome. How can I use this feature?
I found this script on Codepen and tried adding it to my website but it didn’t work!
document.addEventListener('DOMContentLoaded', function () {
var swiper = new Swiper('.swiper-container', {
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
on: {
slideChange: function() {
var activeIndex = swiper.activeIndex;
var accordionButtons = document.querySelectorAll('#accordionExample .accordion-button');
accordionButtons[activeIndex].click();
}
}
});
// Get all accordion buttons
var accordionCollapses = document.querySelectorAll('#accordionExample .accordion-collapse');
accordionCollapses.forEach(function(collapseElement, index) {
collapseElement.addEventListener('show.bs.collapse', function() {
swiper.slideTo(index);
});
});
});
It’s called: Bootstrap Accordion and Slider two way sync. Pls help me 🙁
New contributor
Sơn Nguyễn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.