Carousel activates Accordian?

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
Beth
 
 
Posts: 124
Joined: Mon Jan 15, 2018 10:55 pm

Carousel activates Accordian?

Post 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.
User avatar
Pablo
 
Posts: 24554
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Carousel activates Accordian?

Post 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();
Beth
 
 
Posts: 124
Joined: Mon Jan 15, 2018 10:55 pm

Re: Carousel activates Accordian?

Post 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...
User avatar
BaconFries
 
 
Posts: 6274
Joined: Thu Aug 16, 2007 7:32 pm

Re: Carousel activates Accordian?

Post 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>
Beth
 
 
Posts: 124
Joined: Mon Jan 15, 2018 10:55 pm

Re: Carousel activates Accordian?

Post by Beth »

Thank you so much Crispy. I thought that there should be a way. I'll work on it and let you know.
User avatar
BaconFries
 
 
Posts: 6274
Joined: Thu Aug 16, 2007 7:32 pm

Re: Carousel activates Accordian?

Post by BaconFries »

Thank you so much Crispy?
😮
User avatar
crispy68
 
 
Posts: 3180
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Carousel activates Accordian?

Post by crispy68 »

@bacon :lol:
Post Reply