Carousel activates Accordian?
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
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
-
Beth
-

- Posts: 125
- Joined: Mon Jan 15, 2018 10:55 pm
Carousel activates Accordian?
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.
I can do this by using shapes, too, but how about an accordian panel as the target to be opened?
Any help is appreciated.
- Pablo
- Posts: 24637
- Joined: Sun Mar 28, 2004 12:00 pm
- Location: Europe
- Contact:
Re: Carousel activates Accordian?
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();
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: 125
- Joined: Mon Jan 15, 2018 10:55 pm
Re: Carousel activates Accordian?
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...
- BaconFries
-

- Posts: 6284
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Carousel activates Accordian?
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: 125
- Joined: Mon Jan 15, 2018 10:55 pm
Re: Carousel activates Accordian?
Thank you so much Crispy. I thought that there should be a way. I'll work on it and let you know.
- BaconFries
-

- Posts: 6284
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Carousel activates Accordian?
Thank you so much Crispy?
- crispy68
-

- Posts: 3199
- Joined: Thu Oct 23, 2014 12:43 am
- Location: Acworth, GA
- Contact:
-
Beth
-

- Posts: 125
- Joined: Mon Jan 15, 2018 10:55 pm
Re: Carousel activates Accordian?
Oops!
Thank you Mr. BaconFries. I wasn't paying attention. You both have been so helpful, as is everyone else here on the forum.
Thank you Mr. BaconFries. I wasn't paying attention. You both have been so helpful, as is everyone else here on the forum.
- VictorKrs
-

- Posts: 410
- Joined: Sun May 17, 2020 8:08 pm
Re: Carousel activates Accordian?
Dear BaconFries!
Something doesn't work for me. Or is there something I didn't understand?
Project link: https://drive.google.com/file/d/1xAoG9m ... sp=sharing
Victor
Something doesn't work for me. Or is there something I didn't understand?
Project link: https://drive.google.com/file/d/1xAoG9m ... sp=sharing
Victor
- crispy68
-

- Posts: 3199
- Joined: Thu Oct 23, 2014 12:43 am
- Location: Acworth, GA
- Contact:
- VictorKrs
-

- Posts: 410
- Joined: Sun May 17, 2020 8:08 pm
Re: Carousel activates Accordian?
Hello, dear Ron!
I tried to implement the idea (based on the advice), but something didn't work:(
As always, Ron, you turn a fairy tale into reality!
I find that this functionality can be applied in a number of cases.
Do you share the demo file?
Victor
I tried to implement the idea (based on the advice), but something didn't work:(
As always, Ron, you turn a fairy tale into reality!
I find that this functionality can be applied in a number of cases.
Do you share the demo file?
Victor
- crispy68
-

- Posts: 3199
- Joined: Thu Oct 23, 2014 12:43 am
- Location: Acworth, GA
- Contact:
Re: Carousel activates Accordian?
@victor,
Keep in mind, this only works if the carousel is set to 'flexible' and the accordion is set to 'jquery'. The code may change if you want to use a different set up.
For the accordion, make sure you insert the same number of panels as there are slides in the carousel and set in the accordion options:
Type = jQuery UI
Active Panel = 0
Enter the following code in the page HTML in the 'Before </body>' tag:
Change 'Carousel1' above to the ID of your carousel and 'Accordion1' to the ID of your accordion.
Keep in mind, this only works if the carousel is set to 'flexible' and the accordion is set to 'jquery'. The code may change if you want to use a different set up.
For the accordion, make sure you insert the same number of panels as there are slides in the carousel and set in the accordion options:
Type = jQuery UI
Active Panel = 0
Enter the following code in the page HTML in the 'Before </body>' tag:
Code: Select all
<script>
$(document).ready(function(){
$('#Carousel1').on('slide.bs.carousel', function(e){
var nextIndex = $(e.relatedTarget).index();
$("#Accordion1").accordion("option","active",nextIndex);
});
});
</script>
- VictorKrs
-

- Posts: 410
- Joined: Sun May 17, 2020 8:08 pm
Re: Carousel activates Accordian?
Everything is working! Super!
Thanks a lot for your help, Ron!
Thanks a lot for your help, Ron!