Page 1 of 1

Carousel activates Accordian?

Posted: Tue May 05, 2026 6:27 pm
by Beth
I know how to make carousel no.1 open slides on carousel no.2 using events and javascript like this: "$('#indexCarousel2').bootstrapcarousel(1)" - but can I do the same to make carousel no.1 trigger opening a panel on an accordian ?

I can do this by using shapes, too, but how about an accordian panel as the target to be opened?

Any help is appreciated.

Re: Carousel activates Accordian?

Posted: Tue May 05, 2026 7:47 pm
by Pablo
It depends on which accordion options you have selected.

jQuery UI has an 'active' method:
https://api.jqueryui.com/accordion/

For Bootstrap, you can use collapse
https://getbootstrap.com/docs/5.3/components/collapse/

For example:
bootstrap.Collapse.getOrCreateInstance('#Accordion1-collapse3').toggle();

Re: Carousel activates Accordian?

Posted: Tue May 05, 2026 8:02 pm
by Beth
Thank you for your quick answer Pablo. I'm afraid that this is over my head. I was hoping for something simple but that's OK. Just an idea...

Re: Carousel activates Accordian?

Posted: Thu May 07, 2026 8:31 pm
by BaconFries
Maybe the following will do what you need. You will need to change carousel1 and Accordion1-collapse1 to your own requirements. To use simply.place using Page HTML Between the <head></head> tags* Note untested

Code: Select all

<script>
document.addEventListener('DOMContentLoaded', function () {
  // 1. Identify your Carousel
  var myCarousel = document.getElementById('Carousel1'); 
  
  myCarousel.addEventListener('slid.bs.carousel', function (event) {
    
    // 2. Specify which slide (0 is first, 1 is second, etc.)
    // Let's say you want the 2nd slide to trigger the action:
    if (event.to === 1) { 
      
      // 3. Identify the Accordion Panel ID you want to open
      var panelElement = document.getElementById('Accordion1-collapse1'); 
      
      if (panelElement) {
        var bsCollapse = new bootstrap.Collapse(panelElement, {
          toggle: false // Ensures it stays open if already open
        });
        bsCollapse.show();
      }
    }
  });
});
</script>

Re: Carousel activates Accordian?

Posted: Thu May 07, 2026 9:35 pm
by Beth
Thank you so much Crispy. I thought that there should be a way. I'll work on it and let you know.

Re: Carousel activates Accordian?

Posted: Thu May 07, 2026 10:09 pm
by BaconFries
Thank you so much Crispy?
😮

Re: Carousel activates Accordian?

Posted: Thu May 07, 2026 10:18 pm
by crispy68
@bacon :lol: